Ubuntu 及 Ubuntu SSH 启用 Root 用户

Ubuntu 及 Ubuntu SSH 启用 Root 用户

1、Ubuntu SSH 启用 Root 用户

1.1、切换 Root 用户(切换 Root 用户方便接下来的操作)

sudo su

1.2、备份 config 文件

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

1.3、编辑 sshd_config

nano /etc/ssh/sshd_config

在 sshd_config 文件里的 “Authentication” 部分修改成如下内容。

LoginGraceTime 2m
PermitRootLogin yes
StrictModes yes
# MaxAuthTries 6
# MaxSessions 10

1.4、重启 SSH 服务

service sshd restart

1.5、设置 Root 密码

如果之前设置过,就不用设置。

sudo passwd root xxx

2、Ubuntu 桌面版启用 Root 用户

ubuntu server 版不限制 Root 用户登录(设置好 Root 用户的密码就可以使用),但是限制 SSH 登录。

2.1、切换 Root 用户(切换 Root 用户方便接下来的操作)

sudo su

2.2、设置 Root 用户密码

如果之前设置过,就不用设置。

passwd root xxx

2.3、修改 lightdm 配置文件

lightdm 配置文件在 /usr/share/lightdm/lightdm.conf.d/xxxxx.conf

nano /usr/share/lightdm/lightdm.conf.d/xxxxx.conf

在 lightdm 配置文件增加两行内容。

greeter-show-manual-login=true
all-guest=false

2.4、修改 gdm-autologin

注释掉 auth required pam_succeed_if.so user != root quiet_success

nano /etc/pam.d/gdm-autologin

2.5、修改 gdm-password

注释掉 auth required pam_succeed_if.so user != root quiet_success

nano /etc/pam.d/gdm-password

2.6、修改 profile 文件

将末尾的 mesg n 2> /dev/null || true 这一行注释掉增加一行 tty -s&&mesg n || true

nano /root/.profile

注销之后就可以用 Root 用户登录了。

2.7、Root 用户自动登录

这步非必须,有需要就弄。

nano /etc/gdm3/custom.conf

[daemon] 下的 AutomaticLoginEnableAutomaticLogin 修改成下面的样子。

AutomaticLoginEnable=True
AutomaticLogin=root

3、参考文章

https://blog.csdn.net/weixin_43849522/article/details/108664379

https://www.jianshu.com/p/e2c49128126f

暂无评论

发送评论 编辑评论


|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇