(rootユーザーになる)
●バックアップ
[root@rhe6 ssh]# cp /etc/ssh/sshd_config /root/backup/
★( /etc/ssh/sshd_config に "PermitRootLogin no" を追記する)

●diff で編集内容を確認
[root@rhe6 ssh]# diff sshd_config /root/backup/sshd_config 
42c42
< PermitRootLogin no
---
> #PermitRootLogin no

●sshd の再起動
[root@rhe6 ssh]# cat /var/run/sshd.pid 
2410
★[root@rhe6 ssh]# kill -HUP `cat /var/run/sshd.pid `
[root@rhe6 ssh]# cat /var/run/sshd.pid 
2456
→sshd のプロセスIDが変わった。

(他の端末から、ssh で root でログインする)

[root@rhe6 ssh]# tail -f /var/log/secure
May 31 11:16:25 rhe6 sshd[2800]: Received SIGHUP; restarting.
May 31 11:16:25 rhe6 sshd[2814]: Server listening on 0.0.0.0 port 22.
May 31 11:16:25 rhe6 sshd[2814]: Server listening on :: port 22.
→上の 3行は、sshd を再起動したときに出力されるログ

May 31 11:12:03 rhe6 sshd[2801]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.17.1  user=root
May 31 11:12:05 rhe6 sshd[2801]: Failed password for root from 192.168.17.1 port 50578 ssh2
May 31 11:12:14 rhe6 sshd[2801]: Failed password for root from 192.168.17.1 port 50578 ssh2
May 31 11:12:35 rhe6 sshd[2802]: Connection closed by 192.168.17.1
May 31 11:12:35 rhe6 sshd[2801]: PAM 1 more authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.17.1  user=root

→192.168.17.1 から root でのログインを 2回試みたが、失敗したときのログ
最終更新:2012年07月08日 21:06