When I switch to another user using su myuser it doesnt load any bashrc it seems.

As my command line only has the $ symbol as I want it to have the username in the command line like how when I login as root.

I know I can just copy my root's .bashrc file, but I want to have a default .bashrc so when I do a su to another user it will auto load a default bashrc without having me to copy a .bashrc file to every /home/ user on my server.

What file should I really be editing? I plan to just copy my root's bashrc file to it as I have it customized already.


According the the bash manual, there is no global file for bash when not run as a login shell, just /etc/profile for for login shells and /etc/inputrc for readline.

If you copied root's .bashrc, you should verify that the target user has permission to read the file.

  • Depends on what you mean by "regular shells"... Bash's startup files are tied on whether the shell is interactive or not, and login shell or not. For non-login interactive shells there's /etc/bash.bashrc that corresponds to ~/.bashrc. – ilkkachu Jul 20 at 15:19
  • I mean non login shells. – RalfFriedl Jul 20 at 15:20
  • what is non-login shells? are they different when i do a su to the user? – Patoshi パトシ Jul 21 at 13:36
  • @Patoshiパトシ did you read the bash manual? – RalfFriedl Jul 21 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.