3.
½下来开始修改启动½本服务档!
[root@study ~]#
cd /etc/systemd/system
[root@study system]#
cp /usr/lib/systemd/system/sshd.service sshd2.service
[root@study system]#
vim sshd2.service
[Unit]
Description=OpenSSH server daemon 2
After=network.target sshd
-
keygen.service
Wants=sshd
-
keygen.service
[Service]
EnvironmentFile=/etc/sysconfig/sshd
ExecStart=/usr/sbin/sshd
-
f /etc/ssh/sshd2_config
-
D $OPTIONS
ExecReload=/bin/kill
-
HUP $MAINPID
KillMode=process
Restart=on
-
failure
RestartSec=42s
[Install]
WantedBy=multi
-
user.targ
et
[root@study system]#
systemctl daemon
-
reload
[root@study system]#
systemctl enable sshd2
[root@study system]#
systemctl start sshd2
[root@study system]#
tail
-
n 20 /var/log/messages
# semanage port
-
a
-
t PORT_TYPE
-
p tcp 222
where PORT_TYPE is one of the following: ssh_port_t, vnc_port_t, xserver_port_t.
#
真的看!你
看到上面
这两
句!也就是
SELinux
的埠口
问题
½
[root@study system]#
semanage port
-
a
-
t ssh_port_t
-
p tcp 222
[root@study system]#
systemctl start sshd2
[root@study system]#
netstat
-
tlnp | grep ssh
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1300/sshd
tcp 0 0 0.0.0.0:
222
0.0.0.0:* LISTEN 15275/sshd
tcp6 0 0 :::22 :::* LISTEN 1300/sshd
tcp6 0 0
:::
222
:::* LISTEN 15275/sshd
简答题部分:
.
使用
netstat -tul
netstat -tunl
有什么差异?为何会这样?
使用
n
时,
netstat
就不会使用主机名与服务名称
(hostname & service_name)
来显示,
取而代之的则是以
IP
port number
来显示的。
IP
的分析与
/etc/hosts
/etc/resolv.conf
有关,
这个在未来服务器篇才会提到。至于
port number
则与
/etc/services
有关,请自行参考喔!
^_^