Ubuntu 系统使用 root 用户登录
Ubuntu 系统的默认用户名默认不设置 root 账户和密码。但是可以手动修改;具体操作步骤如下:
1、ssh登录机器
2、执行以下命令,设置 root 密码
sudo passwd root
# 输入两次root密码 出现如下指令则表示已经修改完成
passwd: password updated successfully
3、修改sshd_config 配置文件
sudo vi /etc/ssh/sshd_config
按 i 切换至编辑模式,找到 #Authentication,将 PermitRootLogin 参数修改为 yes。如果 PermitRootLogin 参数被注释,请去掉首行的注释符
找到 #Authentication,将 PasswordAuthentication 参数修改为 yes
若 sshd_config 配置文件中无此配置项,则添加 PasswordAuthentication yes 项即可。
4、按 Esc,输入:wq,保存文件并返回。
5、重启 ssh 服务
sudo service ssh restart