在初始状态下,root用户禁止ssh远程登陆,可以通过以下方法开启
设置ROOT密码
1 |
sudo passwd root |
修改SSH设置
1 |
sudo nano /etc/ssh/sshd_config |
修改标注行
1 2 3 4 5 6 7 8 9 10 |
# Authentication: #LoginGraceTime 2m PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 # To disable tunneled clear text passwords, change to no here! PasswordAuthentication yes #PermitEmptyPasswords no |
执行代码
1 2 |
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config |
启用root
1 2 |
sudo passwd --unlock root passwd: password expiry information changed. |
重启服务
1 |
sudo service ssh restart |
There are no comments yet