Ubuntu16.04中启用root用户,以及root用户自动登录

 http://www.m5home.com/blog/archives/2016/12/103.html 

 

第一步是给root用户设置个密码.

     我没试过空密码行不行,不折腾.


sudo passwd root



第二步是在配置文件里设置自启动:
     1,编辑/etc/lightdm/lightdm.conf:

sudo gedit  /etc/lightdm/lightdm.conf

[Seat:*]
autologin-guest=false
autologin-user=root
autologin-user-timeout=0
greeter-session=lightdm-gtk-greeter


     2,编辑/root/.profile文件,增加tty -s &&:

sudo gedit /root/.profile 

# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi

tty -s && mesg n || true


 

然后重启就行了.

 

 

 

 

关闭guest用户

$ sudo vi /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

 

Ubuntu安装完成默认是普通权限的用户,root用户需要手动开启,并且还不含opne-ssh模块

1.给root用户设置密码

#  sudo passwd root

会提示输入unix的新密码,这就是root的密码

2.测试root用户登录

# sudo su  或者 su root

3.修改配置文件,开启root账号界面登录

# cd /usr/share/lightdm/lightdm.conf.d/

# gedit 50-unity-greeter.conf

在下面添加如下配置:

user-session=ubuntu
greeter-show-manual-login=true

all-guest=false

4.重启系统,使用root账号登录

# reboot

会出现一个错误提示,点击确定进入系统

# vi /root/.profile

把mesg n,修改为:tty -s && mesg n

保存退出,重启系统

# reboot

5. 安装open-ssh模块开启远程登录

# apt-get install openssh-server

查看是否开启:#ps -e |grep ssh

6.开启root远程登录

# vi /etc/ssh/sshd_config


找到并用#注释掉这行:PermitRootLogin prohibit-password

新建一行 添加:PermitRootLogin yes

重启服务

# service ssh restart

至此,root账号远程登录完成

(网络必须打开,不然无法登陆)
--------------------- 
作者:学习达人的日记本 
来源:CSDN 
原文:https://blog.csdn.net/sinat_32247833/article/details/80026578 
版权声明:本文为博主原创文章,转载请附上博文链接!

 

在最后增加allow-guest=false 
保存退出。注销后可看到已经没有guest用户登陆的选项。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值