0

The .bash_profile for user john is not taking effect when I (as root) use the su john command to login as john. I have to use source ~/.bash_profile command every time I login as john using the su john command.

How can I automate this?

Thanks

1 Answers1

1

From man su:

-, -l, --login

Provide an environment similar to what the user would expect had the user logged in directly. When - is used, it must be specified before any username. For portability it is recommended to use it as last option, before any username. The other forms (-l and --login) do not have this restriction.

So to source john's .bash_profile, you should run su -l john.

Panki
  • 6,221
  • 2
  • 24
  • 33