su command question
Smoot Carl-Mitchell
smoot at tic.com
Fri Jul 4 20:16:50 UTC 2008
On Fri, 2008-07-04 at 19:36 +0100, Alan Milnes wrote:
> 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?
> 4) Add this line after it
>
> your_username ALL = (%root) NOPASSWD:/path/to/your/script
This is incorrect. The script will run with the privileges of a user in
the "root" group, instead of the user ventrilo. I am not sure what
happens with the above, since by default there are no users in the
"root" group. You could do this, however:
your_username ALL = (ventrilo) NOPASSWD:/etc/ventrilo/ventrilo_srv
This will only allow the script to be run as user "ventrilo" without a
password for only the user "your_username". You still need to specify
the user when invoking the command:
sudo -u ventrilo /etc/ventrilo/ventrilo_srv
--
Smoot Carl-Mitchell
System/Network Architect
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005
More information about the ubuntu-users
mailing list