Difference between revisions of "LogIn shells"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 55: Line 55:
 
: sourced by .bashrc if it exists
 
: sourced by .bashrc if it exists
 
* /etc/motd
 
* /etc/motd
: displayed as a greeting if it exists
+
: displayed for login shells [http://en.wikipedia.org/wiki/Motd_(Unix) by the login process] as a greeting
  
 
= See also =
 
= See also =

Revision as of 08:55, 12 January 2014

A login shell is a shell to which you log in via console or ssh. This is also true if you have not given your username and password due to passwordless login. If you change your user with the su or sux command, this is no login shell. If you log in using the display manager and start a shell, this is no log in shell. If you call bash -login, you are in a login shell (bash), although you did not login at all.

When you start a login shell, login-scripts will be started, and if you start a shell that is not a login shell, other scripts will be started.

What is a login shell

action log-in-shell
you enter a computer with ssh, typing username and password yes
you enter a computer with ssh using passwordless login yes
you enter a computer by logging in to the Window Manager, using username and password. Then you open konsole by clicking on it. no
you open a console and type su -, then password yes
you open a console and type bash - yes

Example

Here is an example showing which login process calls what scripts:

tweedleburg:~ # su - tstaerk
This is /etc/profile.d/run-on-login-for-all-sh-users.sh
This is /etc/bash.bashrc
This is .bashrc
this is .bash_profile
tstaerk@tweedleburg:~> exit
logout
tweedleburg:~ # su tstaerk
This is /etc/bash.bashrc
This is .bashrc
tstaerk@tweedleburg:/mnt/barracuda/root> exit
exit
tweedleburg:~ # ssh tstaerk@localhost
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Sun Jan 12 09:42:47 2014 from localhost
Have a lot of fun...
This is /etc/profile.d/run-on-login-for-all-sh-users.sh
This is /etc/bash.bashrc
This is .bashrc
this is .bash_profile
tstaerk@tweedleburg:~> cat /etc/motd
Have a lot of fun...
tstaerk@tweedleburg:~> exit

Files

  • /etc/profile.d/*.sh
  • /etc/bash.bashrc
  • ~/.bash_profile
  • ~/.bashrc
  • ~/.alias
sourced by .bashrc if it exists
  • /etc/motd
displayed for login shells by the login process as a greeting

See also