1. 程式人生 > >Ubuntu16.04開啟root使用者,並遠端登入

Ubuntu16.04開啟root使用者,並遠端登入

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賬號遠端登入完成

網路必須開啟,不然無法登陸