让ubuntu使用root帐号并让winscp以root身份登录
ubuntu 服务器默认的root账号是没有激活的,需要用初装的用户账号给root设置管理密码:

$ sudo passwd root 
Password:   //输入密码
Enter new UNIX password:      //提示输入新的root帐户密码
Retype new UNIX password:    //再输入一次确认密码

修改成功之后你就可以使用root账号了,可以使用 su root 命令切换到root。

但是碰到过一次情况,就是修改之后,直接用root账号无法登陆远程终端,这是还需要修改ssh配置文件:

$vim /etc/ssh/sshd_config

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

sudo /etc/init.d/ssh restart   重启ssh服务这样修改才能生效

可以成功登陆了。

Logo

欢迎加入 MCP 技术社区!与志同道合者携手前行,一同解锁 MCP 技术的无限可能!

更多推荐