首先說設定讓 X-Window 自動 login 的方法只是用於特定場所,如實驗室等測試環境,正式環境不建議使用.
- Non – Root User
先建立一個非 root 的帳號並且不要設定其密碼的使用者帳號, 例如: abc.[root@benjr ~]# useradd abc[root@benjr ~]# passwd –d abcroot 預設是無法使用自動 login 的方法,後面會再介紹一種方式可以讓 root 自動登入到 x-windows,要讓非 root 使用者自動登入 x-windows 首先需要編輯 /etc/X11/gdm/gdm.conf 這一個檔案.[root@benjr ~]# vi /etc/X11/gdm/gdm.conf— gdm-conf —[daemon]AutomaticLoginEnable=trueAutomaticLogin=abc……….TimedLoginEnable=trueTimedLogin=abcTimedLoginDelay=30[security]AllowRemoteAutoLogin=true–end—[daemon]- AutomaticLoginEnable=true
設定開機時, 自動登入 - AutomaticLogin=abc
填入指定使用者名稱 - TimedLoginEnable=true
在登出以後 如果使用者在登入畫面沒有動作, 等待一定時間後會自動登入. - TimedLogin=abc
填入指定使用者名稱 - TimedLoginDelay=30
[security]- AllowRemoteAutoLogin=true
接下來重新開機就可以用 abc 這個使用者自動登入到 x-window - AutomaticLoginEnable=true
- Root User
因為系統無法直接讓 root 自動登入 x-window 所以我們先讓 Linux 系統自動登入文字介面 (Run Level 3) ,先修改 /etc/inittab 檔案.[root@benjr ~]# vi /etc/inittab#1:2345:respawn:/sbin/mingetty tty11:2345:once:/sbin/mingetty –autologin root tty1在所需的 tty# 加入 –autologin root 就可以自動登入到文字介面 (Run Level 3).接下來修改 root 的 .bash_profile[root@benjr ~]# vi /root/.bash_profile# .bash_profile# Get the aliasesandfunctionsif[ -f ~/.bashrc ]; then. ~/.bashrcfi# User specific environmentandstartup programsPATH=$PATH:$HOME/binexport PATHunset USERNAMEstartx.bash_profile 是 login system 時會用到的其中一個 shell,主要在最後一行加入 startx 即可,重新開機就可以讓 root 自動登入到 x-window.
XDG automatic Logon
在 RHEL 6 和 ubuntu 採用了 FreeDesktop.org 的規格,FreeDesktop.org 的官方網站 http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html,他定義了基本的 Linux 下的 X Window System (X11) 以及其他 Unix-like 作業系統的桌面環境.主要是為了增加 free software desktop environments 的互通性,而這環境簡稱為 XDG(X Desktop Group).
在 RHEL 6 和 ubuntu 採用了 FreeDesktop.org 的規格,FreeDesktop.org 的官方網站 http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html,他定義了基本的 Linux 下的 X Window System (X11) 以及其他 Unix-like 作業系統的桌面環境.主要是為了增加 free software desktop environments 的互通性,而這環境簡稱為 XDG(X Desktop Group).
所以上述的方式在新的桌面環境已經不適用了,如果要用 x-window 自動登入請自行參考 XDG automatic Logon
沒有留言:
張貼留言