天天看點

Linux設定以root使用者開機自動登入桌面Ubuntu 18.04系統下設定Redhat7.6系統下設定

目錄

Ubuntu 18.04系統下設定

Redhat7.6系統下設定

  • Ubuntu 18.04系統下設定

    1、 允許使用root使用者登入桌面

        Ubuntu預設不允許使用root使用者登入桌面的,首先需要進行如下配置

        編輯/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf将該檔案的配置修改成如下

    [Seat:*]
    user-session=ubuntu
    greeter-show-manual-login=true #在登入時允許使用者自己輸入使用者名和密碼
               
        Ubuntu中的root使用者預設是沒有設定密碼的,是以還需要設定root密碼
    sudo passwd root        #在目前桌面登入的使用者下執行這條指令修改root密碼
    [sudo] user 的密碼:     #輸入目前登入使用者使用者user的密碼
    輸入新的 UNIX 密碼:      #輸入給root密碼
    重新輸入新的 UNIX 密碼:  #再次輸入root密碼
    passwd:已成功更新密碼
               

    2、 允許root開機自動登入桌面

        再次編輯/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf,在該檔案末尾添加如下兩行

    allow-guset=flase   #禁止訪客使用者登入
    Autologin-user=root #指定root為自動登入使用者
               
        編輯完成之後,還需要修改圖形桌面配置,編輯檔案/etc/gdm3/custom.conf,找到[daemon]項,将該項的配置修改至如下
    [daemon]
    AutomaticLoginEnable=true #啟用自動登入
    AutomaticLogin=root       #指定root使用者為自動登入使用者
               
    3、 由于Ubuntu預設是禁止使用root使用者進行ssh遠端登入終端通路的,是以如果需要使用root登入ssh的話則需要再檔案中增加如下配置
    PermitRootLogin yes
               
    4、 重新開機電腦生效
  • Redhat7.6系統下設定

     相比與于Ubuntu系統,Redhat的設定就比較簡單了,隻需要修改/etc/gdm/custom.conf檔案的[daemon]項配置,重新開機後即可生效
    [daemon]
    AutomaticLoginEnable=True
    AutomaticLogin=root
               

繼續閱讀