43

实例:Ubuntu 配置单root用户登录

 5 years ago
source link: https://www.linuxprobe.com/ubuntu-root-login.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

环境搭建好后,用创建的用户进入系统

shell命令
sudo vim usr/share/lightdm.conf.d/50-ubuntu.conf //编辑器不限
[SeatDefaults]
user-session=ubuntu
greeter-show-manual-login=true     #手工输入登录系统的账号密码
allow-guest=false                  #禁止guest登录
修改root密码
sudo passwd root
修改/root/.profile
sudo vim /root/.profile //root首次登录会报错解决方法
# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

fi

#mesg n 注释掉mesg n 增加一行tty -s && mesg n

tty -s && mesg n
修改ssh配置文件允许root登录
sudo vim /etc/ssh/sshd_config
#permitRootLogin without-password 注释掉这行,新增下面一行
permitRootLogin yes

重启ssh服务即可


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK