-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Template
koalaman edited this page Feb 17, 2014
·
21 revisions
./configure
make
su root
make install
./configure
make
sudo make install # or su -c 'make install' root
su
doesn't actually switch user. It starts a brand new shell, running as another user. You can't put su foo
in a script to make the following command run as user foo
.
Use sudo -u username cmd
or su -c cmd username
instead.
If you want to present the user with a root shell or when you're redirecting input, you can ignore this message:
until mycommand
do
echo "Failed. You will now get a root shell. Fix problem and exit to retry."
su
done
or
exec < mycommands
su foo