新装debian 以root登录ssh
ssh登录普通用户
输入sudo -i切换到root环境下
cd /etc/ssh 回车
继续输入
chmod 755 sshd_config 回车 赋予权限
安装vim
apt-get install vim
编辑文件
vim /etc/ssh/sshd_config 或
vi /etc/ssh/sshd_config
修改sshd_config
#PermitRootLogin prohibit-password
I编辑,修改为
PermitRootLogin yes
esc :wq 退出
重启ssh即可
service sshd restart
或
/etc/init.d/ssh restart
之后就可以以root用户ssh登录了
懒人模式
直接使用cat命令在sshd_config文件尾部追加所需要的内容就行,反正上面都是#注释的,不会造成任何冲突。
cat >> /etc/ssh/sshd_config << EOF
PasswordAuthentication yes
PermitRootLogin yes
EOF
service ssh restart
共有 0 条评论