How to run sudo with parallel ssh












0















Linux: ubuntu 14.04.3 LTS



cat /tmp/passfile
ABCxyz123


sshpass -f /tmp/passfile parallel-ssh -I -A -h hostlist.txt "sudo -S ls -l /root" < /tmp/passfile



and the method described here in google discussion groups.google
outputs the error as:



[1] 01:07:25 [FAILURE] 10.0.4.194 Exited with error code 255
[2] 01:07:25 [FAILURE] 10.0.4.205 Exited with error code 255


in the remote server I'm trying to connect its /var/log/auth.log has below message



Sep 24 19:20:52 ubu1401 sshd[5765]: Accepted password for ubuntu from 10.0.4.1 port 55019 ssh2
Sep 24 19:20:52 ubu1401 sshd[5765]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)
Sep 24 19:21:26 ubu1401 sshd[5765]: pam_unix(sshd:session): session closed for user ubuntu
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): conversation failed
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): auth could not identify password for [ubuntu]
Sep 24 19:22:25 ubu1401 sshd[5791]: Connection closed by 10.0.4.1 [preauth]









share|improve this question

























  • try adding -i -v to parallel-ssh to see if it provides any further clues.

    – meuh
    Sep 25 '16 at 19:43
















0















Linux: ubuntu 14.04.3 LTS



cat /tmp/passfile
ABCxyz123


sshpass -f /tmp/passfile parallel-ssh -I -A -h hostlist.txt "sudo -S ls -l /root" < /tmp/passfile



and the method described here in google discussion groups.google
outputs the error as:



[1] 01:07:25 [FAILURE] 10.0.4.194 Exited with error code 255
[2] 01:07:25 [FAILURE] 10.0.4.205 Exited with error code 255


in the remote server I'm trying to connect its /var/log/auth.log has below message



Sep 24 19:20:52 ubu1401 sshd[5765]: Accepted password for ubuntu from 10.0.4.1 port 55019 ssh2
Sep 24 19:20:52 ubu1401 sshd[5765]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)
Sep 24 19:21:26 ubu1401 sshd[5765]: pam_unix(sshd:session): session closed for user ubuntu
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): conversation failed
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): auth could not identify password for [ubuntu]
Sep 24 19:22:25 ubu1401 sshd[5791]: Connection closed by 10.0.4.1 [preauth]









share|improve this question

























  • try adding -i -v to parallel-ssh to see if it provides any further clues.

    – meuh
    Sep 25 '16 at 19:43














0












0








0








Linux: ubuntu 14.04.3 LTS



cat /tmp/passfile
ABCxyz123


sshpass -f /tmp/passfile parallel-ssh -I -A -h hostlist.txt "sudo -S ls -l /root" < /tmp/passfile



and the method described here in google discussion groups.google
outputs the error as:



[1] 01:07:25 [FAILURE] 10.0.4.194 Exited with error code 255
[2] 01:07:25 [FAILURE] 10.0.4.205 Exited with error code 255


in the remote server I'm trying to connect its /var/log/auth.log has below message



Sep 24 19:20:52 ubu1401 sshd[5765]: Accepted password for ubuntu from 10.0.4.1 port 55019 ssh2
Sep 24 19:20:52 ubu1401 sshd[5765]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)
Sep 24 19:21:26 ubu1401 sshd[5765]: pam_unix(sshd:session): session closed for user ubuntu
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): conversation failed
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): auth could not identify password for [ubuntu]
Sep 24 19:22:25 ubu1401 sshd[5791]: Connection closed by 10.0.4.1 [preauth]









share|improve this question
















Linux: ubuntu 14.04.3 LTS



cat /tmp/passfile
ABCxyz123


sshpass -f /tmp/passfile parallel-ssh -I -A -h hostlist.txt "sudo -S ls -l /root" < /tmp/passfile



and the method described here in google discussion groups.google
outputs the error as:



[1] 01:07:25 [FAILURE] 10.0.4.194 Exited with error code 255
[2] 01:07:25 [FAILURE] 10.0.4.205 Exited with error code 255


in the remote server I'm trying to connect its /var/log/auth.log has below message



Sep 24 19:20:52 ubu1401 sshd[5765]: Accepted password for ubuntu from 10.0.4.1 port 55019 ssh2
Sep 24 19:20:52 ubu1401 sshd[5765]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)
Sep 24 19:21:26 ubu1401 sshd[5765]: pam_unix(sshd:session): session closed for user ubuntu
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): conversation failed
Sep 24 19:21:26 ubu1401 sudo: pam_unix(sudo:auth): auth could not identify password for [ubuntu]
Sep 24 19:22:25 ubu1401 sshd[5791]: Connection closed by 10.0.4.1 [preauth]






linux ubuntu ssh parallel-ssh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 25 '16 at 2:45









agc

4,60811036




4,60811036










asked Sep 24 '16 at 19:26









satch_boogiesatch_boogie

160213




160213













  • try adding -i -v to parallel-ssh to see if it provides any further clues.

    – meuh
    Sep 25 '16 at 19:43



















  • try adding -i -v to parallel-ssh to see if it provides any further clues.

    – meuh
    Sep 25 '16 at 19:43

















try adding -i -v to parallel-ssh to see if it provides any further clues.

– meuh
Sep 25 '16 at 19:43





try adding -i -v to parallel-ssh to see if it provides any further clues.

– meuh
Sep 25 '16 at 19:43










2 Answers
2






active

oldest

votes


















0














have you tried running this via echoing the password in the shell?



echo "echo 'yourpassword'; sudo -S -c 'ls -l /root'"|pssh -I -H hostlist.txt






share|improve this answer





















  • 1





    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review

    – countermode
    Oct 21 '16 at 14:58











  • @countermode this is how I run pssh sudo. That basically answers the question in the headline: "How to run sudo with parallel ssh"

    – Alex
    Oct 21 '16 at 16:26











  • i used ansible instead of the parallel ssh (i wanted to check disk usage ,free memory etc)

    – satch_boogie
    Oct 22 '16 at 17:23



















0














To provide the password as securely, as possible, try this version (pssh on CentOS, Fedora and parallel-ssh on Ubuntu, Debian):



stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
ssh <USER>@localhost "sudo -S dmesg"



and then adapt it to pssh like this:



stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
pssh -H <USER>@localhost -o /tmp/output -I "sudo -S dmesg"



I use the same for ad-hoc collection of dumps from multiple servers. Stop it using Ctrl + C as usual. It will show [FAILURE] <HOST> Interrupted, but that is just because tcpdump would otherwise run infinitely - the output is still in the usual location. The -t 0 option is so the connection doesn't time out. I could also use tmux or screen and collect the dumps later.



stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
pssh -h <HOSTFILE> -o /tmp/output -t 0 -I "sudo -S tcpdump -l -nn -vv -i any not port 22"



Make sure to include the correct ssh user and that you connected to those servers before. Testing things locally usually prevents taking down the entire fleet of servers. You can use the 127.0.0.X addresses instead of localhost to approximate multiple hosts.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f312106%2fhow-to-run-sudo-with-parallel-ssh%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    have you tried running this via echoing the password in the shell?



    echo "echo 'yourpassword'; sudo -S -c 'ls -l /root'"|pssh -I -H hostlist.txt






    share|improve this answer





















    • 1





      This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review

      – countermode
      Oct 21 '16 at 14:58











    • @countermode this is how I run pssh sudo. That basically answers the question in the headline: "How to run sudo with parallel ssh"

      – Alex
      Oct 21 '16 at 16:26











    • i used ansible instead of the parallel ssh (i wanted to check disk usage ,free memory etc)

      – satch_boogie
      Oct 22 '16 at 17:23
















    0














    have you tried running this via echoing the password in the shell?



    echo "echo 'yourpassword'; sudo -S -c 'ls -l /root'"|pssh -I -H hostlist.txt






    share|improve this answer





















    • 1





      This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review

      – countermode
      Oct 21 '16 at 14:58











    • @countermode this is how I run pssh sudo. That basically answers the question in the headline: "How to run sudo with parallel ssh"

      – Alex
      Oct 21 '16 at 16:26











    • i used ansible instead of the parallel ssh (i wanted to check disk usage ,free memory etc)

      – satch_boogie
      Oct 22 '16 at 17:23














    0












    0








    0







    have you tried running this via echoing the password in the shell?



    echo "echo 'yourpassword'; sudo -S -c 'ls -l /root'"|pssh -I -H hostlist.txt






    share|improve this answer















    have you tried running this via echoing the password in the shell?



    echo "echo 'yourpassword'; sudo -S -c 'ls -l /root'"|pssh -I -H hostlist.txt







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Oct 22 '16 at 8:06

























    answered Oct 21 '16 at 14:09









    AlexAlex

    1114




    1114








    • 1





      This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review

      – countermode
      Oct 21 '16 at 14:58











    • @countermode this is how I run pssh sudo. That basically answers the question in the headline: "How to run sudo with parallel ssh"

      – Alex
      Oct 21 '16 at 16:26











    • i used ansible instead of the parallel ssh (i wanted to check disk usage ,free memory etc)

      – satch_boogie
      Oct 22 '16 at 17:23














    • 1





      This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review

      – countermode
      Oct 21 '16 at 14:58











    • @countermode this is how I run pssh sudo. That basically answers the question in the headline: "How to run sudo with parallel ssh"

      – Alex
      Oct 21 '16 at 16:26











    • i used ansible instead of the parallel ssh (i wanted to check disk usage ,free memory etc)

      – satch_boogie
      Oct 22 '16 at 17:23








    1




    1





    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review

    – countermode
    Oct 21 '16 at 14:58





    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review

    – countermode
    Oct 21 '16 at 14:58













    @countermode this is how I run pssh sudo. That basically answers the question in the headline: "How to run sudo with parallel ssh"

    – Alex
    Oct 21 '16 at 16:26





    @countermode this is how I run pssh sudo. That basically answers the question in the headline: "How to run sudo with parallel ssh"

    – Alex
    Oct 21 '16 at 16:26













    i used ansible instead of the parallel ssh (i wanted to check disk usage ,free memory etc)

    – satch_boogie
    Oct 22 '16 at 17:23





    i used ansible instead of the parallel ssh (i wanted to check disk usage ,free memory etc)

    – satch_boogie
    Oct 22 '16 at 17:23













    0














    To provide the password as securely, as possible, try this version (pssh on CentOS, Fedora and parallel-ssh on Ubuntu, Debian):



    stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
    ssh <USER>@localhost "sudo -S dmesg"



    and then adapt it to pssh like this:



    stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
    pssh -H <USER>@localhost -o /tmp/output -I "sudo -S dmesg"



    I use the same for ad-hoc collection of dumps from multiple servers. Stop it using Ctrl + C as usual. It will show [FAILURE] <HOST> Interrupted, but that is just because tcpdump would otherwise run infinitely - the output is still in the usual location. The -t 0 option is so the connection doesn't time out. I could also use tmux or screen and collect the dumps later.



    stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
    pssh -h <HOSTFILE> -o /tmp/output -t 0 -I "sudo -S tcpdump -l -nn -vv -i any not port 22"



    Make sure to include the correct ssh user and that you connected to those servers before. Testing things locally usually prevents taking down the entire fleet of servers. You can use the 127.0.0.X addresses instead of localhost to approximate multiple hosts.






    share|improve this answer






























      0














      To provide the password as securely, as possible, try this version (pssh on CentOS, Fedora and parallel-ssh on Ubuntu, Debian):



      stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
      ssh <USER>@localhost "sudo -S dmesg"



      and then adapt it to pssh like this:



      stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
      pssh -H <USER>@localhost -o /tmp/output -I "sudo -S dmesg"



      I use the same for ad-hoc collection of dumps from multiple servers. Stop it using Ctrl + C as usual. It will show [FAILURE] <HOST> Interrupted, but that is just because tcpdump would otherwise run infinitely - the output is still in the usual location. The -t 0 option is so the connection doesn't time out. I could also use tmux or screen and collect the dumps later.



      stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
      pssh -h <HOSTFILE> -o /tmp/output -t 0 -I "sudo -S tcpdump -l -nn -vv -i any not port 22"



      Make sure to include the correct ssh user and that you connected to those servers before. Testing things locally usually prevents taking down the entire fleet of servers. You can use the 127.0.0.X addresses instead of localhost to approximate multiple hosts.






      share|improve this answer




























        0












        0








        0







        To provide the password as securely, as possible, try this version (pssh on CentOS, Fedora and parallel-ssh on Ubuntu, Debian):



        stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
        ssh <USER>@localhost "sudo -S dmesg"



        and then adapt it to pssh like this:



        stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
        pssh -H <USER>@localhost -o /tmp/output -I "sudo -S dmesg"



        I use the same for ad-hoc collection of dumps from multiple servers. Stop it using Ctrl + C as usual. It will show [FAILURE] <HOST> Interrupted, but that is just because tcpdump would otherwise run infinitely - the output is still in the usual location. The -t 0 option is so the connection doesn't time out. I could also use tmux or screen and collect the dumps later.



        stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
        pssh -h <HOSTFILE> -o /tmp/output -t 0 -I "sudo -S tcpdump -l -nn -vv -i any not port 22"



        Make sure to include the correct ssh user and that you connected to those servers before. Testing things locally usually prevents taking down the entire fleet of servers. You can use the 127.0.0.X addresses instead of localhost to approximate multiple hosts.






        share|improve this answer















        To provide the password as securely, as possible, try this version (pssh on CentOS, Fedora and parallel-ssh on Ubuntu, Debian):



        stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
        ssh <USER>@localhost "sudo -S dmesg"



        and then adapt it to pssh like this:



        stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
        pssh -H <USER>@localhost -o /tmp/output -I "sudo -S dmesg"



        I use the same for ad-hoc collection of dumps from multiple servers. Stop it using Ctrl + C as usual. It will show [FAILURE] <HOST> Interrupted, but that is just because tcpdump would otherwise run infinitely - the output is still in the usual location. The -t 0 option is so the connection doesn't time out. I could also use tmux or screen and collect the dumps later.



        stty -echo; printf "Password: "; read PWD; stty echo; echo "${PWD}" |
        pssh -h <HOSTFILE> -o /tmp/output -t 0 -I "sudo -S tcpdump -l -nn -vv -i any not port 22"



        Make sure to include the correct ssh user and that you connected to those servers before. Testing things locally usually prevents taking down the entire fleet of servers. You can use the 127.0.0.X addresses instead of localhost to approximate multiple hosts.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 12 '18 at 12:00

























        answered Dec 12 '18 at 11:49









        AdamKaliszAdamKalisz

        19216




        19216






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f312106%2fhow-to-run-sudo-with-parallel-ssh%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀