2019/3/25
修正前 | 修正後 |
#Port 22 | #22以外を指定2222,8022,22222とか #well-knownポートは避ける Port 2222 |
PermitRootLogin yes | rootによるログインを拒否 PermitRootLogin no |
cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/ssh-2222.xml vi /etc/firewalld/services/ssh-2222.xml #port="22"をport="2222"に修正 #SELinuxの設定 ;man semanage-port でオプションがわかる semanage port --add --type ssh_port_t --proto tcp 2222 firewall-cmd --list-all ;#sshがあるか? firewall-cmd --permanent --remove-service=ssh firewall-cmd --permanent --add-service=ssh-2222 firewall-cmd --reload firewall-cmd --list-all ;#sshはない ssh-2222があるか? #sshd_configを読み込む systemctl restart sshd
ssh -p 2222 xxxx@webserver.takahashi.lab使用頻度が高いのでaliasするとよいでしょう。
alias ssh='ssh -p 2222' alias sftp='sftp -P 2222' alias scp='scp -P 2222'