

These workarounds are needed for the combination of GNU su and Bash see "su 5.2.1 does not invoke bash as a login shell". The - option ensures that the -l and -c options are passed to the shell rather than used by su itself.Bash does not do the normal login process in non-interactive login mode unless it is forced with the -l option.Because a command is specified with the -c option, the shell is also run in "non-interactive mode".The - option invokes a "login shell" by prepending a dash (-) to its name.X:5:once:/bin/su - PREFERRED_USER -l -c '/usr/bin/startx /dev/null 2>&1' Your session will also not be authorized as 'local' by ConsoleKit, so you will be unable to shutdown/suspend/reboot or mount drives without using sudo or su. Note: This method will not use /bin/login or register your session, therefore no session will appear in who or w. In order to avoid this, remove the exec part from the script. The user will be logged out when X is killed. *) printf '%s\n' 'Please answer y or n.' ) exec xinit - /usr/bin/X -nolisten tcp vt7 Read -p 'Do you want to start X? (y/n): ' Or with additional checking (if tty1 ( Ctrl+Alt+F1) shows an error message): #exec xinit - /usr/bin/X -nolisten tcp vt7

If you use zsh as your preferred shell, add the following lines to your ~/.zprofile instead.): Both will execute ~/.xinitrc, which may be customized to start the window manager of choice as described in the xinitrc article.Īn alternative to a login manager is to add the following to the bottom of your ~/.bash_profile (if ~/.bash_profile does not yet exist, you can copy a skeleton version from /etc/skel/.bash_profile. To manually start X, startx or xinit are used. The inittab way allows automatically starting X without supplying a password. The bash_profile method will start X once logged in from a tty. This article introduce two methods without display manager. The majority of users use display manager to start X server. Covers bash_profile and inittab methods to start an X server during the boot process.
