how to run sudo command such that it wont prompt for password

Asked by srihari

Hi,

I m new to linux env.
I have used pon, poff to connect/disconnect internet/adsl. I m successfull in connecting to net thru cmd line.
Now i want to connect to internet at specific time.
I want to use crontab for scheduling.

my crontab file ( o/p crontab -e)

# m h dom mon dow command
03 00 * * * /home/rudra/connect.sh
05 06 * * * /home/rudra/disconnect.sh
~
shell scripts contain
#!/bin/bash
sudo poff dsl-provider

#!/bin/bash
sudo pon dsl-provider

when i run the cmd, prompted for sudo password.
How to overcome this.

above cronjobs didnt execute.

o/p echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

Any suggestions, i m not able to make out where i missed out.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu sudo Edit question
Assignee:
No assignee Edit question
Solved by:
srihari
Solved:
Last query:
Last reply:
Revision history for this message
hardcorelinux (hardcorelinux) said :
#1

:/etc/sudoers:
 10 # Uncomment to allow members of group sudo to not need a password
 11 # %sudo ALL=NOPASSWD: ALL

Revision history for this message
srihari (srihari2009) said :
#2

thanks.
I m able to solve the prob with ur suggestion.
I added these to /etc/sudoers file.
#permissions to run pon/poff without password prompt
rudra ALL=(root) /usr/bin/pon /usr/bin/poff /usr/bin/apt-get