You don't actually need su
in the command at all (what your sudo su - user
does is to use sudo
to jump to root
with full privileges, and then use su
to downgrade to the account called user
. You might as well just jump straight to user
with sudo
).
One of these lines will work, depending on how /connect/ndm/bin
has been added to your $PATH
. Use the first one that works:
sudo -u user direct
sudo -iu user direct
sudo -Hiu user direct
The first variant runs direct
as user user
. The second variant also tells the target shell to run in "interactive" mode, which means for bash
it would execute .bash_profile
or .profile
, setting up the environment ($PATH
, etc.). The final version also forces the $HOME
variable to be set for the target user account too. With some configurations this is done automatically by sudo
but I included it here anyway "just in case".
direct
? Is it a command found in the PATH or is it a shell function/alias?user
's shell, what doestype -a direct
show?