I need to revoke the sudo access to the user using sed in scripts.
I want to comment the user only if the line contains /bin/su - root
Let us consider the file as below, in which I have to comment only the first line.
mindadmin ALL = NOPASSWD: /bin/su - root mindadmin ALL = NOPASSWD: /bin/ifconfig
I have used
sed commands as below:
sed -e 's/minadmin[\s]+ALL[\s]+=[\s]+NOPASSWD:[\s]+/bin/su - root/#mindadmin ALL = NOPASSWD: /bin/su - root/g' /etc/sudoers
But it is not working. Is there any syntax error in it?