how to run script from user hdfs without password
0
votes
0
answers
137
views
we create the following script on rhel 7.6
/home/run_tasks
and in visudo we configured
%sudo ALL=(ALL:ALL) ALL
root ALL=(ALL) ALL
hdfs ALL = (ALL) ALL
hdfs ALL= (root) NOPASSWD: /home/run_tasks
and
ls -ltr /home/run_tasks
-rwxrwxrwx 1 hdfs hdfs 6377 Sep 11 2019 /home/run_tasks
so when we run the script as
su hdfs -c "sudo /home/run_tasks"
we get
sudo: sorry, you must have a tty to run sudo
and after we marked the following lines ( from visudo )
#Defaults requiretty
#Defaults !visiblepw
we get
su hdfs -c "sudo /home/run_tasks"
ls: Permission denied: user=root, access=EXECUTE, inode="/../../..":hdfs:hdfs:drwxr-x---
ls: Permission denied: user=root, access=EXECUTE, inode="/../../..":hdfs:hdfs:drwxr-x---
Asked by yael
(13936 rep)
Sep 13, 2020, 02:09 PM
Last activity: Sep 13, 2020, 03:39 PM
Last activity: Sep 13, 2020, 03:39 PM