su command question

Raseel Bhagat raseelbhagat at gmail.com
Fri Jul 4 18:39:31 UTC 2008


Hi Robert,

On Fri, Jul 4, 2008 at 9:27 PM, Robert Dailey <rcdailey at gmail.com> 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? I also
> don't want this to be a security issue (for example, I don't want
> people to be able to connect to my server using PuTTY and login as
> 'ventrilo' with no password...
>

Since you are using all this from a script, you can use "expect".
The sequence of commands would go something like this :
spawn <your comand>
expect "Password:"
send "<your password>"
interact

To get expect :
sudo apt-get install expectk


Thanks,
Raseel
http://raseel.in/techblog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080705/27f1b99d/attachment.html>


More information about the ubuntu-users mailing list