Why is this by passing the SUDO password?

Posted by John Isaacks on Ask Ubuntu See other posts from Ask Ubuntu or by John Isaacks
Published on 2010-12-29T15:21:29Z Indexed on 2010/12/29 15:59 UTC
Read the original article Hit count: 292

Filed under:
|
|
|

I have a bash script I am using to automate a SVN checkout. The contents of the file were:

#!/bin/bash

cd /var/www-cake

sudo svn checkout file:///usr/local/svn/bash_repo/repo/

Then when I double click the file it would ask me what to do, I would click the button "Run In Terminal" and then a terminal would pop up and ask me for the SUDO password. I would enter it, the script would execute and the terminal would close.

I wanted to give some sort of indication that the script ran successfully so I edited my file to look like:

#!/bin/bash

cd /var/www-cake

sudo svn checkout file:///usr/local/svn/bash_repo/repo/

echo "Head revision has been pushed to live server"

I expected the terminal to now stay open and tell me the message afterwards. To my surprise it now opens and immediately closes. The script does execute and I no longer have to put in the SUDO password.

Is this right? I do not understand why this is happening, seems like a security issue.

© Ask Ubuntu or respective owner

Related posts about security

Related posts about bash