What user runs the commands defined in /etc/rc.local?
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 su
and sudo
is that:
su
requires you to know the password of that alternate user, wheresudo
will prompt for the password of the user running thesudo
command and requires setup so that the user is allowed to run the requested commands/programs.
(When root
runs either su
or 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 su
or sudo
to the commands/programs that need to run as root.
You may still need to use su
or sudo
in your init scripts if those commands need to be executed not as root
but another user/service-account...
su -
oracle
/do/something/as/oracle/user
Yes, all the scripts and programs are directly called by root.
The /etc/rc.local
file is called directly by the init process.