I have implemented a small beowulf cluster for testing purpose, all nodes with Ubuntu server 18.04.
I have installed
pdsh for running the same command on ssh at the same time on multiple node.
ssh login is granted passwordless with public/private key distribution over the nodes (example: https://www.rittmanmead.com/blog/2014/12/linux-cluster-sysadmin-ssh-keys/) .
If I try a simple command like "date" , all is fine:
me@master:~$ pdsh -w me@node[0-3] date node0: Mon Mar 9 18:56:04 UTC 2020 node2: Mon Mar 9 17:26:15 UTC 2020 node3: Mon Mar 9 16:42:37 UTC 2020 node1: Mon Mar 9 17:42:52 UTC 2020 me@master:~$
But if I try a command that require a sudoer privileges like this:
me@master:~$ pdsh -w me@node[0-3] apt update
then it returns these errors:
node0: WARNING: apt does not have a stable CLI interface. Use with caution in scripts. node0: node0: Reading package lists... node0: E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) node0: E: Unable to lock directory /var/lib/apt/lists/ node0: W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) node0: W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) pdsh@node00: node0: ssh exited with exit code 100
and so on for all other nodes.
The problem is the "apt update" command that require a sudo execution but I have not found a way to pass it with pdsh
The same kind of commands launched with "real" root user runs fine:
root@master:~$ pdsh -w root@node[0-3] apt update
But in this case this means actually enabling the "real" root user on all nodes, which I would like to avoid.
Is it posssible? Is there a way for running elevated privileges commands with
pdsh without enabling the root user? Or are there alternative tools that can do this?