pathbashuser-administration

bash_profile for new user created through useradd


I created a new user in RHEL7

useradd newuser

When I opened the ~/.bash_profile of this user, the output is

 $cat -n ~/.bash_profile
 1  # .bash_profile
 2
 3  # Get the aliases and functions
 4  if [ -f ~/.bashrc ]; then
 5      . ~/.bashrc
 6   fi
 7    
 8  # User specific environment and startup programs
 9    
 10  PATH=$PATH:$HOME/.local/bin:$HOME/bin
 11
 12  export PATH
 $

From where this bash_profile is inherited to the newly added user? If I need to removing appending of $PATH for the every new user created using useradd. How can I do that ?


Solution

  • From /etc/skel (or SKEL_DIR from -k) as explained in the man page for the -m/--create-home option most likely.

    If you don't want that then don't have useradd create the home directory and/or just delete the file after the user is created.