run a script in boot as user using /etc/rc.local
I am trying to run a script at boot using /etc/rc.local.
it works fine but runs as root and I want to run it as user. I tried sudo -u user /path-to-file and it didn't work (the script didn't run). Any solution will be appreciated. |
See man setuid and man setuidgid.
|
How about "su - user -c command"?
|
su will work, too.
Below is a live example with setuidgid. Code:
#!/bin/sh |
Thanks everyone - su worked.
|
All times are GMT -5. The time now is 11:29 AM. |