bash - How to run a script hourly that requires password? -
i want call script every hour doing using following commands:
step 1. connect cloud desktop using ssh. step 2. run these commands: % screen % while true; ./parsescript.sh; sleep 3600; done step 3. close window running command. step 4. (same step 1) connect cloud desktop using ssh. step 5. run command: screen -r. session left in step 3.
now problem in script have 1 command has executed using sudo hence ask password every time, there anyway run script every hour except manually?
you can configure sudo not require password combination of user , command.
for instance, if username needs run command keshav
, command @ /sbin/somecommand
:
first create copy of sudoers file, in case
sudo cp /etc/sudoers /etc/sudoers.backup
then edit /etc/sudoers
sudo visudo
that command open /etc/sudoers
file in default editor. use editor add line
keshav = nopasswd: /sbin/somecommand
save file , exit editor.
if followed steps correctly user keshav
should able run sudo /sbin/somecommand
without password prompt
Comments
Post a Comment