學了Linux,才知道是多麼的不可思議。學習Linux命令讓我受益匪淺!
1、SSH遠程服務的管理操作
A、通過兩種方式來拒絕開放一個端口22(SSH端口):
要求:一種是通過修改配置文件並重新加載配置;另一種是通過命令操作方式來實現拒絕一個端口,並測試端口是否通。
1)
cd /etc/firewalld/zones <service name="ssh"/>行 保存並退出
firewall-cmd --reload 重載防火牆配置文件
2)
[wangxiaobo@bogon ~]# firewall-cmd--add-port=22/tcp --permanent 開放一個ssh端口,
success
[wangxiaobo@bogon ~]# firewall-cmd --reload 重載配置文件
success
[wangxiaobo@bogon ~]# netstat -an | grep :22 查看端口狀態
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.164:22 192.168.1.148:49693 ESTABLISHED 已連通
tcp6 0 0 :::22 :::* LISTEN
[wangxiaobo@bogon ~]# firewall-cmd--remove-port=22/tcp --permanent 刪除ssh端口
success
[wangxiaobo@bogon ~]# firewall-cmd --reload 重載配置文件
success
B、通過兩種方式來結束ssh服務,並把步驟寫在上面;
1):輸入命令:systemctl stop sshd.service
2):輸入 ps –aux|grep sshd 查看sshde進程號然後在輸入 kill -9 ssh進程號結束ssh服務
C、把ssh服務設置成開機禁用
輸入sysytemctl disable sshd.service
然後輸入reboot 重啟虛擬機
再輸入 systemctl is–enable sshd.service;
2、查看自己虛擬機的軟(系統)硬件(CPU、內存、硬盤、主板)信息,
CPU信息:
[wangxiaobo@bogon Desktop]$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Model name: Intel(R) Core(TM) i3-2328M CPU @ 2.20GHz
Stepping: 7
CPU MHz: 2195.020
BogoMIPS: 4390.04
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0
內存信息:
[wangxiaobo@bogon Desktop]$ more /proc/m
mdstat meminfo misc modules mounts mpt/ mtrr
[wangxiaobo@bogon Desktop]$ more /proc/meminfo
MemTotal: 1001332 kB
MemFree: 71312 kB
MemAvailable: 278756 kB
Buffers: 208 kB
Cached: 311388 kB
SwapCached: 0 kB
Active: 411612 kB
Inactive: 236468 kB
Active(anon): 321732 kB
Inactive(anon): 23268 kB
Active(file): 89880 kB
Inactive(file): 213200 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 2097148 kB
SwapFree: 2097148 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 336496 kB
Mapped: 101724 kB
Shmem: 8500 kB
Slab: 85716 kB
SReclaimable: 33976 kB
硬盤信息:
[wangxiaobo@bogon Desktop]$ smartctl -a /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-327.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
Smartctl open device: /dev/sda failed: Permission denied
上面的是作業,接下來的旅行還會看到不同的風景,期待著一次次不同的風景出現在我的眼前,我也會把握這次機會好好欣賞沿途的風景!!!!