设置新root账户密码

Ubuntu服务器默认的root账号是没有激活的 , 需要用初装的用户账号给root设置管理密码 , 如下所示 :

$ sudo passwd root    // 用sudo修改root帐户密码
  Password:    // 输入密码
  Enter new UNIX password:   // 输入新的root帐户密码
  Retype new UNIX password:   // 确认密码 
  • 1
  • 2
  • 3
  • 4
  • 5

使用Xshell连接登录

先在要连接的Ubuntu主机下开启SSH服务 , 如果没有开启需要安装openssh-server :

sudo apt-get install openssh-server
  • 1
  • 2

使用ps -e | grep ssh , 如果只有ssh-agent表示还没启动 , 需要/etc/init.d/ssh start ;
有sshd说明已启动 , 还是不行直接reboot

以上完成后打开Xshell , ,选择 “新建”->”连接”设置里选择SSH , 主机填入需要连接的主机的IP地址 , 在”用户身份验证”中填入可用的登录Ubuntu的用户名和密码即可

使用Winscp以root身份登录

修改配置文件 :

vim /etc/ssh/sshd_config 

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes

将 PermitRootLogin without-password 修改为 PermitRootLogin yes , 如下所示 : 

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。