≡ Menu

Why and How To Customize a UNIX / Linux User Account?

Q. Can you tell more about UNIX user account customization along with some sample configuration?

A. Usually useradd / adduser and passwd commands are used for creating an entry for a user in /etc/passwd, /etc/shadow and /etc/group files. However, adding user in files may not provide all the functionality needed. You need to set user customization by modifying various scripts located at /etc or ~/ (user home directory). These scripts executed at the start of every console (text based) login or ssh session to setup the user’s environment.

Typical UNIX / Linux login scenario

User login / SSH Login
System login script /etc/profile
Personal login script $HOME/.profile
Shell startup script $HOME/.bash_profile $HOME/.shrc 
User logged in (login complete)

You can add system wide customization using /etc/profile file. End users can manage their own profile / custom environment using personal login script or shell startup script.

Why customize a UNIX / Linux / BSD user account?

Following are few common examples:

  1. Set the JDK / JVM / PATH variables
  2. Set the user’s terminal type
  3. Customize the user’s prompt
  4. Set a default text editor
  5. Setup historyfile size and location
  6. Run reports as soon as you log into account etc
  7. Set a command line shortcuts and aliases

Sample Customization

$ cat ~/.bash_profile
export TERM=xterm # my terminal type
export PS1="$ " # my sweet prompt
export JAVA_HOME=/opt/jvm/java-6-sun #for java
export PATH=$PATH:$JAVA_HOME/bin:/home/vivek/bin # my binary file search path
export EDITOR=vim # my editor
export HISTSIZE=100 # history file size
export HISTFILE=~/.cmd_history # history file location
umask 077 # my umask
ulimit -c 0 # unlimited core file
# some shell variables
set -o noclobber
set -o physical
shopt -s cdspell
shopt -s extglob
shopt -s dotglob
shopt -s cmdhist
shopt -s lithist
shopt -s progcomp
shopt -s checkhash
shopt -s histreedit
shopt -s promptvars
shopt -s cdable_vars
shopt -s checkwinsize
shopt -s hostcomplete
shopt -s expand_aliases
shopt -s interactive_comments
bind '"\C-t": possible-completions' # replaces 'transpose-chars'
bind '"\M-t": menu-complete' # replaces 'transpose-words'

View environment variables list

Simply user env command, enter:
$ env

/etc/skel directory to push configuration to user

By default all files from /etc/skel are copied to the new user’s home directory; when a new user account created. There are few files included in /etc/skel/ by default.

  • /etc/skel/.bash_logout
  • /etc/skel/.bashrc
  • /etc/skel/.profile
  • /etc/skel/.cshrc
  • /etc/skel/.exrc (/etc/skel/.vimrc)

You can also create or copy existing scripts in /etc/skel. For example copy /usr/share/vim/vimrc to /etc/skel/.vimrc
# cp /usr/share/vim/vimrc /etc/skel/.vimrc
Now file /etc/skel/.vimrc will be copied when a new user account created.

Suggested readings:

  • man pages bash, csh, ksh, sh
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 5 comments… add one }
  • Craig Wayman February 4, 2008, 1:43 pm


    The last few sentences talk of /etc/.vimrc and they should be /etc/skel/.vimrc


  • nixCraft February 4, 2008, 2:00 pm


    Thanks for the heads up.

  • clusteradmin.blogspot.com February 8, 2008, 11:52 am

    To customize adding/deleting users even more but still use the built-in tools, adduser/deluser can be used.
    It has config files and custom scripts that can be run automatically when a user is added/deleted:



  • Earle Joseph February 26, 2008, 12:00 pm

    Your answers are crips but explicit. They are very educational and helpful

  • minakshi August 24, 2011, 7:01 am

    proper definition of customize enviornment

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , , ,