简单爱 大佬有话说 :
求助,甲骨文用公钥登录以后怎么改成root➕密码登录
各位吴彦祖,目前是用公钥登录的,不但麻烦,而且登录上去以后在ssh端还不看到文件列表,很头疼。我记得有个命令是用公钥登录以后可以改成用密码登录的,现在找不到了,知道的人麻烦发一下,感激不尽!
cicvc 大佬有话说 :
echo "密码" | passwd –stdin root > /dev/null;sed -i ‘s/#PermitRootLogin yes/PermitRootLogin yes/g’ /etc/ssh/sshd_c*;sed -i ‘s/#PasswordAuthentication yes/PasswordAuthentication yes/g’ /etc/ssh/sshd_c*;sed -i ‘s/PasswordAuthentication no//g’ /etc/ssh/sshd_c*; service sshd restart
未完的歌 大佬有话说 :
首先登录后切换为root,如下命令修改root密码
passwd
依次执行如下代码:
sed -i "s/PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
sed -i "s/PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config
# 重启sshd服务
systemctl restart sshd