Which files contain individual user login / logout commands
Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Which files contain individual user login / logout commands
I want to have fetchmail start when a certain user logs in (to X-Windows) and I want it to stop when that user logs out. Do such user configuration files exist? I have searched the web and the Red Hat 9 documentation but haven't been about to locate an answer to this seemingly simple question.
thanks for the info. I edited those two files and it seems to be working. I thought that the bash files were only executed if I opened up a Terminal window or logged in using text mode. I learned something new.
If you enter the command info bash and do a search for .bash_profile you can get more information.
To save you time here is a snippet from the info display.
Invoked as an interactive login shell, or with `--login'
........................................................
When Bash is invoked as an interactive login shell, or as a
non-interactive shell with the `--login' option, it first reads and
executes commands from the file `/etc/profile', if that file exists.
After reading that file, it looks for `~/.bash_profile',
`~/.bash_login', and `~/.profile', in that order, and reads and
executes commands from the first one that exists and is readable. The
`--noprofile' option may be used when the shell is started to inhibit
this behavior.
When a login shell exits, Bash reads and executes commands from the
file `~/.bash_logout', if it exists.
I think that the ~/.bash_login script is intended for logging in to via a tty connection, whereas ~/.bash_profile is what is normally used.
.bash_profile is where you add to the default $PATH
whereas .bashrc, is where you would enter user aliases.
Note that we made the assumption that you are using an X windows session manager to log-in. These bash startup files execute when bash is started a log-in shell. If you start your session by typing startx. You might want to include a script in the ~/.kde/Autostart/ folder instead.
You will want to look around for a .bash_logout equivalent for a KDE session.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.