Quantcast
Channel: Switch user in a init script? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Switch user in a init script?

$
0
0

Here's my Init script which I have at my Ubuntu workstation. I need to run a command as another user than root, but I just can't get my head around how it should be done. Neither sudo -u or su newuser seems to work.

The script:

respawnconsole nonestart on runlevel [2345]stop on runlevel [06]script  su "anotherUser" -c ./myCommandend script

Viewing all articles
Browse latest Browse all 4

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>