I try to comment on a line in / etc / sudoers
via a shell script I am doing This is the relevant line I would like to edit:
# grep '\! Requite '/ etc / sudoers default: nagios! Requiretty
But it seems that the way I am using with sed
is wrong, my attempt is:
# sed -i 's / ^ default \: nagios $ / # default: ngosos! Jurority / G / E / Sdoders # sed -i 's / ^ Defaults: Nagoya $ / #defaults: Nagas! Zeri / G '/ At / Esdoes # SAD-Eye' s / ^ Default: Nagian $ / # Default: Nagois! Zeri / G '/ etc / sudoers # sed -i' s / ^ Default: nagios $ / \ # Default: nagios! Requiretty / g '/ etc / sudoers # sed -i' s / ^ Default: nagios $ / \ # Default: Nagas \! Zeri / G '/ etc / Sueders # sed -i' s / ^ Default: Nagoya $ / ^ # Default: Nagios! Zeri / gi '/ etc / sudoers # sed -i' s / ^ default \: nagios $ / ^ # default: Nagas! Zeri / gi '/ etc / sudoers # sed -i' s / ^ basics \ nagios $ / # default: nagios \! Requite / g '/ etc / sudoers
Thanks in advance
Good ... sudoers
is not writeable by anyone - even root too. You want to edit it with the command visudo instead of for security reasons.
I think you can look back at it, though sed
is the replacement find . The second part is the replacement. So you want to do something like this:
sed -i 's / ^ basics: nagios! Requite $ / # Default: 'nagios /'
This will also remove kititi
if you want you to go to #
If you want to add, you can do this:
sed -i 's / ^ default: nagios! Requiretty $ / # & amp; / '
Comments
Post a Comment