Skip to content


edit /etc/sudoers with pssh

I have to find a way to manage /etc/sudoers on a global scale like for example with AD…? But till I reach this stage, here is a one liner that I use to append to a specific line in this file.
In this case, I need to add to the end of line that starts with ‘User_Alias DBAS =’. Here is the one liner stored in a file called ‘editSuers’:

#!/bin/bash
sed --in-place '/^User_Alias DBAS =/s/.*/&, new_user/' /etc/sudoers

In the line above, the ‘new_user’ will be replaced with login name of the user we need to add to the DBAS alias.
To run in across a number of hosts (which names are stored in the file called someHosts) using ‘pssh’, I do as shown next.

# pssh -h someHosts -P -I <./editSudoers

Posted in LINUX.

Tagged with , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

WordPress Anti Spam by WP-SpamShield



Copyright © 2016 - 2018 Waldemar Mark Duszyk. All Rights Reserved. Created by Blog Copyright.