1

I have a shell script moveInvoice.sh with chmod 777 permission as user test1 and all other scripts are under user test2.

Now I need to call moveInvoice.sh from test2 I tried following

sudo -c 
sudo -u

But all are giving permission denied. Is there any other way to make it run with test2 user ?

once manually I am able to execute then I need to put this in crontab

Sanvi
  • 75
  • 2
  • 9
  • Try with linux acl – Rupesh May 26 '17 at 03:44
  • I cannot use acl bcos it needs utilities to be installed. Since it is office network we dont have any root access to install such. So any command line commands will be helpful. – Sanvi May 26 '17 at 03:48
  • Write a binary wrapper for the script that can `setuid()` [Here's](https://stackoverflow.com/a/24919588/4162356) an example. – James Brown May 26 '17 at 04:58

1 Answers1

1

You can set up a user on Linux to be able to run sudo without a password by adding a NOPASSWD option in visudo.

run sudo visudo as root and then add your user under privilege specification as SOMEUSER ALL=(ALL) NOPASSWD: ALL.

now, SOMEUSER will be able to run sudo commands without a password.

Rob Cha
  • 139
  • 12