I use su - targetuser -s /bin/bash
from a root shell.
For direct command execution use -c
:
su - targetuser -s /bin/bash -c "/bin/echo hello world"
Use sudo. This will work even if the user doesn't have a real shell.
I use su - targetuser -s /bin/bash
from a root shell.
For direct command execution use -c
:
su - targetuser -s /bin/bash -c "/bin/echo hello world"
Use sudo. This will work even if the user doesn't have a real shell.