Re: Login script!
"Rudy Broersma" wrote:
>Hi,
>
>Is it possible that Linux executes a script file when a user logs on?
>So for example, if user RUDY logs on, it executes the /home/rudy/script
>file, and when ROOT logs on, it executes the /root/script file!
>
>Could anybody please give me some examples?
Yes.
Exactly how it works depends a lot on what your setup is.
1) Not using xdm
a) Shell is sh, bash, ash, ksh or other Bourne-shell derivative:
Every login (except, perhaps, root?) first runs /etc/profile.
Next a file in your home directory is run; which one it is depends on
which shell you are running. Default for Bourne shell is .profile;
for bash it is .bash_profile; other shells may have different
behaviour - read the man page.
b) Shell is csh, tcsh:
.login in your home directory is run
2) Using xdm (log-in in a graphical screen)
If you have a .xsession file in your home directory, it is run; if you
don't, /etc/X11/Xsession is run.
Any of these scripts can run other scripts, without limit.
Different scripts get run if you start a new shell when you are already
logged in.
sh - [nothing]
bash - $HOME/.bash_rc
ksh - [contents of $ENV variable]
csh - $HOME/.cshrc
startx - $HOME/.xinitrc; /usr/X11R6/lib/X11/xinit/xinitrc if $HOME/.xinitrc
does not exist
others may be different again - check the man pages
Some Unix systems require these scripts to be executable.
--
Vote against SPAM: http://www.politik-digital.de/spam/
========================================
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"Do not be anxious about anything; but in every thing
by prayer and supplication with thanksgiving let your
requests be made known unto God."
Philippians 4:6
Reply to: