su command question

Alan Milnes deep64blue at itguru.org.uk
Fri Jul 4 18:36:33 UTC 2008


Robert Dailey wrote:
> HI,
> 
> I'm running Ubuntu Server 8.04 and I'm creating a bash script to start
> a server program as follows:
> 
> su ventrilo -c "/etc/ventrilo/ventrilo_srv -d"
> 
> However, the 'su' command makes me insert the password for user
> 'ventrilo' when I run the bash script containing the line of code
> above. How can I make this work without the password prompt? 

You need to give your script, and only that script, root privileges:-

1) Open a terminal window

2) Type "sudo visudo"

3) Look for the line beginning root  ALL

4) Add this line after it

your_username ALL = (%root) NOPASSWD:/path/to/your/script

Needless to say use this with caution - anyone who can change your 
script can run anything as root using it.

Alan




More information about the ubuntu-users mailing list