Are the commands in
/etc/rc.local ran by
su by default?
Do I need to specific
sudo before each command or will they be ran by
su is not a user it's program to run subsequent commands/programs under an alternate identity of another user than the one executing the command. It is very similar to
sudo in that regard.
Unless another user is specified both commands will default to running the command under the alternate identity of the
root user, the superuser/administrator.
The main difference between
sudo is that:
surequires you to know the password of that alternate user, where
sudowill prompt for the password of the user running the
sudocommand and requires setup so that the user is allowed to run the requested commands/programs.
root runs either
sudo no password is required.)
Like any init script, the
/etc/rc.local script is executed by the
root user and you do not need to prepend either
sudo to the commands/programs that need to run as root.
You may still need to use
sudo in your init scripts if those commands need to be executed not as
root but another user/service-account...