bugGNU Parallel - Bugs: bug #37617, feature request: support for sudo...


bug #37617: feature request: support for sudo over ssh

Submitter:  Ben Booth <benwbooth>
Submitted:  Tue 23 Oct 2012 01:35:01 AM UTC
Category:  None Severity:  1 - Wish
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Thu 03 Jan 2013 01:10:29 PM UTC, comment #4: 

This will allow for combined commands (id;id):

cat passwd | parallel -S lo --pipe -q sudo -S bash -c id\;id

--onall and --pipe must still be combineable. Not sure how to do that best.

Currently we read a block and fork. Will it be OK if we read a block, copy the block to --onall, fork, and then read the next block? It will be sufficient for holding the password.

The problem would be if the command expects to get a copy of all the stdin (e.g. wc).

Ole Tange <tange>
Group administrator
Wed 24 Oct 2012 10:56:57 AM UTC, comment #3: 

The good news is that GNU Parallel supports profiles, so you can have a 'sudo' profile:

parallel -J sudo -S .. do_sudo_stuff

Ole Tange <tange>
Group administrator
Tue 23 Oct 2012 04:24:44 PM UTC, comment #2: 

That seems reasonable, although it might still be useful to have a built-in option for running commands under sudo. It seems like this would be a common use case for system admins.

Ben Booth <benwbooth>
Tue 23 Oct 2012 01:13:07 PM UTC, comment #1: 

If --onall could be combined with --pipe then this should work:

echo password | parallel -S server1,server2 --onall --pipe sudo -S do_stuff

The idea here being that the stdin would be copied to all servers.

Would that be sufficient to you?

Maybe it is better to discuss this on the mailinglist: parallel@gnu.org.

Ole Tange <tange>
Group administrator
Tue 23 Oct 2012 01:35:01 AM UTC, original submission:  

It would be nice if GNU parallel could handle executing remote ssh commands with sudo. This would require GNU parallel to ask the user for the sudo password at the terminal before running the jobs, then send the password to the sudo command's stdin using the sudo -S option. There could also be a --user option which tells sudo to execute the command as a user besides root, using the sudo -u <user> option.

SSH power tool has this functionality: http://code.google.com/p/sshpt/, but it's not as powerful as GNU parallel. This option would make it much easier to execute remote administrative commands over ssh.


Ben Booth <benwbooth>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by tange (Posted a comment)
  • -email is unavailable- added by benwbooth (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-10-23 tange Severity3 - Normal 1 - Wish

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code