由于部分服务器提供商出于安全考虑默认关闭了服务器的ssh密码登录,例如Google Cloud Platform
- 登录服务器
使用网页登录或手机客户端连接到服务器,或者使用key登录
- 切换到root用户
1# 执行
2sudo su
3# 编辑文件
4vi /etc/ssh/sshd_config
找到以下部分
1# Authentication:
2LoginGraceTime 120
3PermitRootLogin yes //默认为no,需要开启root用户访问改为yes
4StrictModes yes
5# Change to no to disable tunnelled clear text passwords
6PasswordAuthentication yes //默认为no,改为yes开启密码登陆
重启SSH服务使修改生效
/etc/init.d/ssh restart
除另有声明外,本博客文章均采用 知识共享 (Creative Commons) 署名 4.0 国际许可协议 进行许可。转载请注明原作者与文章出处。