ssh以root用户登录ubuntu服务器
程序员文章站
2022-06-05 18:38:12
...
-
更改root密码
一般情况安装Ubuntu时,不会提示root用户的相关信息,自然无法知道root用户的密码.Ubuntu的root用户的密码是随机的,即每一次开机,都有一个新的root密码.我们在以其他用户进入系统后,可以使用sudo passwd 命令修改密码,输入新的密码后,此时的密码就是root用户的密码.之后再输入su root 就用这个密码就可以了.
-
用ssh 以root用户登录服务器
有了root用户的密码,还不能用ssh登录该服务器,因为ssh默认是阻止以root用户进行远程登录的.
要使用root 用户登录,需要更改配置文件,做一下操作
[email protected]:~ $ ssh [email protected].168.122.xxx #以普通用户登录 [email protected].168.122.xxx's password: Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-36-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Thu Oct 25 08:09:04 UTC 2018 System load: 0.0 Processes: 93 Usage of /: 7.6% of 97.93GB Users logged in: 0 Memory usage: 9% IP address for ens3: 192.168.122.190 Swap usage: 0% * Security certifications for Ubuntu! We now have FIPS, STIG, CC and a CIS Benchmark. - http://bit.ly/Security_Certification * Want to make a highly secure kiosk, smart display or touchscreen? Here's a step-by-step tutorial for a rainy weekend, or a startup. - https://bit.ly/secure-kiosk * Canonical Livepatch is available for installation. - Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch 28 packages can be updated. 0 updates are security updates. Last login: Thu Oct 25 08:00:28 2018 from 192.168.122.1 [email protected]:~$ su root #切换到root用户 Password: #修改配置文件 [email protected]:/home/eric# vim /etc/ssh/sshd_config -----注释掉 PermitRootLogin without-password ------添加 PermitRootLogin yes #####重启服务 [email protected]:/home/eric# /etc/init.d/ssh restart [ ok ] Restarting ssh (via systemctl): ssh.service. [email protected]:/home/eric# exit #退出后重新以root登录 [email protected]:~ $ ssh [email protected].168.122.xxx [email protected].168.122.xxx's password: Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-36-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Thu Oct 25 08:13:38 UTC 2018 System load: 0.0 Processes: 95 Usage of /: 7.6% of 97.93GB Users logged in: 0 Memory usage: 9% IP address for ens3: 192.168.122.190 Swap usage: 0% * Security certifications for Ubuntu! We now have FIPS, STIG, CC and a CIS Benchmark. - http://bit.ly/Security_Certification * Want to make a highly secure kiosk, smart display or touchscreen? Here's a step-by-step tutorial for a rainy weekend, or a startup. - https://bit.ly/secure-kiosk * Canonical Livepatch is available for installation. - Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch 28 packages can be updated. 0 updates are security updates. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. #登录成功 [email protected]:~#
上一篇: 阿里巴巴 fastjson maven
推荐阅读
-
管理用SSH远程登录Linux服务器的用户的权限
-
Ubuntu 18.1远程登录服务器--ssh的安装
-
ubuntu16.04服务器配置ssh免密码登录
-
ubuntu18.04获取root权限并用root用户登录的实现
-
Linux中禁止root用户SSH登录及修改SSH端口的方法
-
Ubuntu创建用户、设置密码、设置SSH远程秘钥登录
-
Ubuntu如何启用root用户登录
-
Ubuntu20.04 SSH无法登陆root用户 Permission denied, please try again
-
ubuntu server 20.04 设置root用户登录
-
ubuntu20.04 以root用户登录提示找不到用户