Mohammedz.com

For Linux and Shell scripting.


1 Comment

/etc/skel directory: Do something special for all users on a system.

I was wondering how can I run few programs for every users while they are logging in & logging out. After a bit of searching I reached at /etc/skel/ directory. Yes, it was the perfect match for my requirement !.

You might have seen few files like .bashrc, .bash_profile (.profile), .bash_logout in every users home directory. Do you know how these files are being generated for the first time?. Yes, it is from /etc/skel/ directory. If you check this directory, you can see all the above mentioned files there.

If you want to verify this, go to /etc/skel/ directory and create a test file. Then, create a new user in the system. When you log into the system as the new user, you can see the testfile in the home directory.