Walker News

How To Enable Linux Logout Script?

By using default configuration, Redhat Linux (RHEL 5.2) automatically creates .bash_profile and .bash_logout in home directory of each new and existing user accounts.

These files are known as login and logout script respectively, as Bash shell automatically executes $HOME/.bash_profile upon user login and execute $HOME/.bash_logout immediately after the exit command is entered.

If your Linux distribution doesn’t contain $HOME/.bash_logout script, just try manually create one with permission at least set to 644 and put in commands that you expect the logout script to run.

If this doesn’t work, append the following line to login script
trap '$HOME/.bash_logout;exit' 0

and then change the script permission from 644 to at least 500, i.e. chmod 500 $HOME/.bash_logout.

Custom Search

2018  •  Privacy Policy