Pssh exited with error code 255

pssh(1) — Linux man page pssh — parallel ssh program Synopsis Description pssh is a program for executing ssh in parallel on a number of hosts. It provides features such as sending input to all of the processes, passing a password to ssh, saving output to files, and timing out. The PSSH_NODENUM and PSSH_HOST […]

Содержание

  1. pssh(1) — Linux man page
  2. Synopsis
  3. Description
  4. Options
  5. Examples
  6. Exit Status
  7. Authors
  8. PSSH error 255
  9. Ensure AV Gear Plays Nice on the Corporate Network
  10. 6 Replies
  11. Read these next.
  12. poor wifi, school’s third floor
  13. Need help crafting a job posting for an IT Pro
  14. Snap! — AI Eye Contact, Mine Batteries, Headset-free Metaverse, D&D Betrayal
  15. Spark! Pro series – 13th January 2023
  16. Support Questions

pssh(1) — Linux man page

pssh — parallel ssh program

Synopsis

Description

pssh is a program for executing ssh in parallel on a number of hosts. It provides features such as sending input to all of the processes, passing a password to ssh, saving output to files, and timing out.

The PSSH_NODENUM and PSSH_HOST environment variables are sent to the remote host. The PSSH_NODENUM variable is assigned a unique number for each ssh connection, starting with 0 and counting up. The PSSH_HOST variable is assigned the name of the host as specified in the hosts list. Note that sshd drops environment variables by default, so sshd_config on the remote host must include the line: AcceptEnv PSSH_NODENUM PSSH_HOST

Options

-h host_file —hosts host_file Read hosts from the given host_file. Lines in the host file are of the form [user@]host[:port] and can include blank lines and comments (lines beginning with «#»). If multiple host files are given (the -h option is used more than once), then pssh behaves as though these files were concatenated together. If a host is specified multiple times, then pssh will connect the given number of times. -H

«[user@]host[:port] [ [user@]host[:port ] . ]» Add the given host strings to the list of hosts. This option may be given multiple times, and may be used in conjunction with the -h option. -l user —user user Use the given username as the default for any host entries that don’t specifically specify a user. -p parallelism —par parallelism Use the given number as the maximum number of concurrent connections. -t timeout —timeout timeout Make connections time out after the given number of seconds. With a value of 0, pssh will not timeout any connections. -o outdir —outdir outdir Save standard output to files in the given directory. Filenames are of the form [user@]host[:port][.num] where the user and port are only included for hosts that explicitly specify them. The number is a counter that is incremented each time for hosts that are specified more than once. -e errdir —errdir errdir Save standard error to files in the given directory. Filenames are of the same form as with the -o option. -x args —extra-args args Passes extra SSH command-line arguments (see the ssh(1) man page for more information about SSH arguments). This option may be specified multiple times. The arguments are processed to split on whitespace, protect text within quotes, and escape with backslashes. To pass arguments without such processing, use the -X option instead. -X arg —extra-arg arg Passes a single SSH command-line argument (see the ssh(1) man page for more information about SSH arguments). Unlike the -x option, no processing is performed on the argument, including word splitting. To pass multiple command-line arguments, use the option once for each argument. -O options —options options SSH options in the format used in the SSH configuration file (see the ssh_config(5) man page for more information). This option may be specified multiple times. -A —askpass Prompt for a password and pass it to ssh. The password may be used for either to unlock a key or for password authentication. The password is transferred in a fairly secure manner (e.g., it will not show up in argument lists). However, be aware that a root user on your system could potentially intercept the password. -i —inline Display standard output and standard error as each host completes. —inline-stdout Display standard output (but not standard error) as each host completes. -v —verbose Include error messages from ssh with the -i and options. -I —send-input Read input and send to each ssh process. Since ssh allows a command script to be sent on standard input, the -I option may be used in lieu of the command argument. -P —print Display output as it arrives. This option is of limited usefulness because output from different hosts are interleaved.

Examples

Connect to host1 and host2, and print «hello, world» from each: pssh -i -H «host1 host2» echo «hello, world» Print «hello, world» from each host specified in the file hosts.txt: pssh -i -h hosts.txt echo «hello, world» Run a command as root with a prompt for the root password: pssh -i -h hosts.txt -A -l root echo hi Run a long command without timing out: pssh -i -h hosts.txt -t 0 sleep 10000 If the file hosts.txt has a large number of entries, say 100, then the parallelism option may also be set to 100 to ensure that the commands are run concurrently: pssh -i -h hosts.txt -p 100 -t 0 sleep 10000 Run a command without checking or saving host keys: pssh -i -H host1 -H host2 -x «-O StrictHostKeyChecking=no -O UserKnownHostsFile=/dev/null -O GlobalKnownHostsFile=/dev/null» echo hi Print the node number for each connection (this will print 0, 1, and 2): pssh -i -H host1 -H host1 -H host2 ‘echo $PSSH_NODENUM’

If you have a set of hosts that you connect to frequently with specific options, it may be helpful to create an alias such as: alias pssh_servers=»pssh -h /path/to/server_list.txt -l root -A» The ssh_config file can include an arbitrary number of Host sections. Each host entry specifies ssh options which apply only to the given host. Host definitions can even behave like aliases if the HostName option is included. This ssh feature, in combination with pssh host files, provides a tremendous amount of flexibility.

Exit Status

The exit status codes from pssh are as follows:

Syntax or usage error

At least one process was killed by a signal or timed out.

All processes completed, but at least one ssh process reported an error (exit status 255).

There were no ssh errors, but at least one remote command had a non-zero exit status.

Written by Brent N. Chun and Andrew McNabb .

Источник

PSSH error 255

Here’s what I’m trying to do. I’ve a number of Ubuntu servers (version 18 and 20), and I’m wanting to run the same script against several of them.

It’s my understanding that parallel-ssh will do the trick for me.

Here’s what I’ve done.

First things I did was install parallel-ssh using sudo apt-get install pssh

next I create to files. The first I created using sudo nano

I copied and pasted the following in and saved it:

# show system uptime

I saved that, and then created another using nano

This is text file that consists of several IP addresses set up as:

username IP_Address ​ with the username being our admin account and ip address being the Ubuntu servers.

then I an it using parallel-ssh -h pssh-hosts -A -P -I local_offer Tagged Items

  • IP_Address
  • Ensure AV Gear Plays Nice on the Corporate Network

    Double checked that. IP address’s are correct.

    Could also be a permission issue. You could follow this guide to get it working using key generation technique. https://www.cyberciti.biz/cloud-computing/how-to-use-pssh-parallel-ssh-program-on-linux-unix/ Opens a new window

    nano is safe, but cut and paste might be your problem.

    You may have introduced CR/LF into your files on Linux, which expects to see LF only as its end of line.

    Maybe the issue is with the password. I’m guessing successful logins are NOT logged on the target machines.

    You might try allocating a tty by passing the » -t » ssh option in your pssh command. If that doesn’t work try » -tt «.

    From the ssh man page:

    «-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.»

    » -t » is an ssh option. To pass it from pssh, I think you’d do so with the » -O » or » —options «, from pssh.

    From the pssh man page:

    -O options —options options SSH options in the format used in the SSH configuration file (see the ssh_config(5) man page for more information). This option may be specified multiple times.

    A couple of ideas. Here is a post from a different forum (2016) with a user experiencing the same issue. The accepted answer seems like it did the trick for the OP back then.

    Another idea, remove the admin username from the host file and specify it with the -l option. You can also get a more verbose output of errors using the -i option.

    Third idea to try. Generate an ssh key-pair and copy the public key to each server. This bypasses the need for a password. Then start an ssh agent using

    Then you can add your private key to the agent using ssh-add /path/to/private/key.

    This will allow you to run pssh without the -A option.

    Hope these options give you some direction to go!

    This topic has been locked by an administrator and is no longer open for commenting.

    To continue this discussion, please ask a new question.

    Read these next.

    poor wifi, school’s third floor

    I work as a help desk technician at a high school for a school district. Teachers/students on the building’s third floor have been reporting poor wifi, with their Chromebooks/laptops etc experiencing slow connectivity and random disconnections. We hav.

    Need help crafting a job posting for an IT Pro

    I’d really appreciate some thoughts and advice. I’m looking to hire an IT pro to be our resident go-to for all things IT (device support, SQL Server, network admin, etc) but who also is interested in learning — or even has some experience in — the.

    Snap! — AI Eye Contact, Mine Batteries, Headset-free Metaverse, D&D Betrayal

    Your daily dose of tech news, in brief. Welcome to the Snap! Flashback: January 13, 1874: Adding Machine Patented (Read more HERE.) Bonus Flashback: January 13, 1990: Astronauts awakened to the song Attack of the Killer Tomatoes (Read mor.

    Spark! Pro series – 13th January 2023

    Happy Friday the 13th! This day has a reputation for being unlucky, but I hope that you’ll be able to turn that around and have a great day full of good luck and good fortune. Whether you’re superstitious or not, .

    Источник

    Support Questions

    • Subscribe to RSS Feed
    • Mark Question as New
    • Mark Question as Read
    • Float this Question for Current User
    • Bookmark
    • Subscribe
    • Mute
    • Printer Friendly Page

    Created ‎08-01-2016 11:47 AM

    ]# pssh -v -t 0 -l root -h clusterhost.txt -x «-t -t -oStrickHostKeyChecking=no» ‘touch testing’

    [1] 17:06:00 [FAILURE] 10.00.01 Exited with error code 255

    [2] 17:06:00 [FAILURE] 10.00.02 Exited with error code 255

    [3] 17:06:00 [FAILURE] 10.00.03 Exited with error code 255

    [4] 17:06:00 [FAILURE] 10.00.04 Exited with error code 255

    Created ‎08-01-2016 01:27 PM

    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    try this command:-

    pssh -v -h clusterhost.txt -l root -A -i «touch testing»———>>>>——->>>>Added ip’s in clusterhost.txt

    And for the hostname this command is works:-

    pssh -v -h «clusterhost.txt» -A -i «-O StrictHostKeyChecking=no» -l root «touch abc.txt» ——->>>>Added hostname in clusterhost.txt

    Because this both command works for me.

    If this this is the your answer, then let’s close this.

    Created ‎08-01-2016 12:40 PM

    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    check your clusterhost.txt — did you provide correct IP addresses?? — 10.00.01 is not a valid ip address. You may have missed a ‘.’ between 2 0’s (10.0.0.1) instead??

    Were you able to ssh to the hosts individually??

    Created ‎08-02-2016 03:36 AM

    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Yep i have given all correct IP for this , while pasting here i changed it.

    Created ‎08-01-2016 01:27 PM

    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    try this command:-

    pssh -v -h clusterhost.txt -l root -A -i «touch testing»———>>>>——->>>>Added ip’s in clusterhost.txt

    And for the hostname this command is works:-

    pssh -v -h «clusterhost.txt» -A -i «-O StrictHostKeyChecking=no» -l root «touch abc.txt» ——->>>>Added hostname in clusterhost.txt

    Because this both command works for me.

    If this this is the your answer, then let’s close this.

    Created ‎08-02-2016 12:52 PM

    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Thanks for your reply it worked for me.

    ]# pssh -v -h «host.txt» -A -i «-O StrictHostKeyChecking=no» -l root «touch sshkeys.txt»

    Warning: do not enter your password if anyone else has superuser privileges or access to your account. Password:

    Источник

    I’d like to use my passphrase protected SSH key when performing tasks with parallel-ssh (and related tools). However, I can’t get this to work.

    All the documentation, regarding parallel-ssh, show that I should be able to use --askpass or -A to do this:

    -A
    --askpass
          Prompt  for  a  password  and pass it to ssh.  The password may be 
          used for either to unlock a key or for password authentication.  The 
          password is transferred in a fairly secure manner (e.g., it will not 
          show up in argument lists).  However, be aware that a root user on 
          your system could potentially intercept the password.
    

    However, when I enter the passphrase of my key, it doesn’t work:

    $ parallel-ssh --hosts=machines --user=my_user --askpass 
        --timeout=0 --inline -v 'sudo apt-get update'
    Warning: do not enter your password if anyone else has superuser
    privileges or access to your account.
    Password: 
    [1] 09:59:36 [FAILURE] amritiii Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [2] 09:59:37 [FAILURE] gbdev Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [3] 09:59:37 [FAILURE] code Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [4] 09:59:37 [FAILURE] apollo Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [5] 09:59:37 [FAILURE] odin Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [6] 09:59:37 [FAILURE] hathor Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [7] 09:59:37 [FAILURE] ldap Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [8] 09:59:37 [FAILURE] thor Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    [9] 09:59:37 [FAILURE] bioserver Exited with error code 255
    Stderr: Enter passphrase for key '/home/nhaigh/.ssh/id_rsa': 
    Permission denied (publickey,password).
    

    I’ve confirmed that my SSH key and passphrase work on each of the machines so I have no idea how to get this working.

    In my code I have the following to run a remote script.

    ssh root@host.domain.com "sh /home/user/backup_mysql.sh"
    

    For some reason it keeps 255’ing on me. Any ideas?

    I can SSH into the box just fine (passless keys setup)

    REMOTE SCRIPT:

    MUSER='root' 
    MPASS='123123'
    MHOST="127.0.0.1"
    VERBOSE=0
    
    ### Set bins path ###
    GZIP=/bin/gzip
    MYSQL=/usr/bin/mysql
    MYSQLDUMP=/usr/bin/mysqldump
    RM=/bin/rm
    MKDIR=/bin/mkdir
    MYSQLADMIN=/usr/bin/mysqladmin
    GREP=/bin/grep
    
    ### Setup dump directory ###
    BAKRSNROOT=/.snapshots/tmp
    
    #####################################
    ### ----[ No Editing below ]------###
    #####################################
    ### Default time format ###
    TIME_FORMAT='%H_%M_%S%P'
    
    ### Make a backup ###
    backup_mysql_rsnapshot(){
            local DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
            local db="";
            [ ! -d $BAKRSNROOT ] && ${MKDIR} -p $BAKRSNROOT
            ${RM} -f $BAKRSNROOT/* >/dev/null 2>&1
    #       [ $VERBOSE -eq 1 ] && echo "*** Dumping MySQL Database ***"
    #       [ $VERBOSE -eq 1 ] && echo -n "Database> "
            for db in $DBS
            do
                    local tTime=$(date +"${TIME_FORMAT}")
                    local FILE="${BAKRSNROOT}/${db}.${tTime}.gz"
    #               [ $VERBOSE -eq 1 ] && echo -n "$db.."
                    ${MYSQLDUMP} --single-transaction -u ${MUSER} -h ${MHOST} -p${MPASS} $db | ${GZIP} -9 > $FILE
            done
    #               [ $VERBOSE -eq 1 ] && echo ""
    #               [ $VERBOSE -eq 1 ] && echo "*** Backup done [ files wrote to $BAKRSNROOT] ***"
    }
    
    ### Die on demand with message ###
    die(){
            echo "$@"
            exit 999
    }
    
    ### Make sure bins exists.. else die
    verify_bins(){
            [ ! -x $GZIP ] && die "File $GZIP does not exists. Make sure correct path is set in $0."
            [ ! -x $MYSQL ] && die "File $MYSQL does not exists. Make sure correct path is set in $0."
            [ ! -x $MYSQLDUMP ] && die "File $MYSQLDUMP does not exists. Make sure correct path is set in $0."
            [ ! -x $RM ] && die "File $RM does not exists. Make sure correct path is set in $0."
            [ ! -x $MKDIR ] && die "File $MKDIR does not exists. Make sure correct path is set in $0."
            [ ! -x $MYSQLADMIN ] && die "File $MYSQLADMIN does not exists. Make sure correct path is set in $0."
            [ ! -x $GREP ] && die "File $GREP does not exists. Make sure correct path is set in $0."
    }
    
    ### Make sure we can connect to server ... else die
    verify_mysql_connection(){
            $MYSQLADMIN  -u $MUSER -h $MHOST -p$MPASS ping | $GREP 'alive'>/dev/null
            [ $? -eq 0 ] || die "Error: Cannot connect to MySQL Server. Make sure username and password are set correctly in $0"
    }
    
    ### main ####
    verify_bins
    verify_mysql_connection
    backup_mysql_rsnapshot
    

    5

    This is usually happens when the remote is down/unavailable; or the remote machine doesn’t have ssh installed; or a firewall doesn’t allow a connection to be established to the remote host.

    ssh returns 255 when an error occurred or 255 is returned by the remote script:

     EXIT STATUS
    
         ssh exits with the exit status of the remote command or
         with 255 if an error occurred.
    

    Usually you would an error message something similar to:

    ssh: connect to host host.domain.com port 22: No route to host
    

    Or

    ssh: connect to host HOSTNAME port 22: Connection refused
    

    Check-list:

    • What happens if you run the ssh command directly from the command line?

    • Are you able to ping that machine?

    • Does the remote has ssh installed?

    • If installed, then is the ssh service running?

    answered Feb 14, 2013 at 23:30

    P.P's user avatar

    6

    This error will also occur when using pdsh to hosts which are not contained in your «known_hosts» file.

    I was able to correct this by SSH’ing into each host manually and accepting the question «Do you want to add this to known hosts».

    1

    If there’s a problem with authentication or connection, such as not being able to read a password from the terminal, ssh will exit with 255 without being able to run your actual script. Verify to make sure you can run ‘true’ instead, to see if the ssh connection is established successfully.

    answered Feb 14, 2013 at 23:28

    that other guy's user avatar

    that other guythat other guy

    114k11 gold badges167 silver badges192 bronze badges

    Isn’t the problem in the lines:

    ### Die on demand with message ###
    die(){
      echo "$@"
      exit 999
    }
    

    Correct me if I’m wrong but I believe exit 999 is out of range for an exit code and results in a exit status of 255.

    1

    I was stumped by this. Once I got passed the 255 problem… I ended up with a mysterious error code 1. This is the foo to get that resolved:

     pssh -x '-tt' -h HOSTFILELIST -P "sudo yum -y install glibc"
    

    -P means write the output out as you go and is optional. But the -x ‘-tt’ trick is what forces a psuedo tty to be allocated.

    You can get a clue what the error code 1 means this if you try:

    ssh AHOST "sudo yum -y install glibc"
    

    You may see:

    [slc@bastion-ci ~]$ ssh MYHOST "sudo yum -y install glibc"
    sudo: sorry, you must have a tty to run sudo
    [slc@bastion-ci ~]$ echo $?
    1
    

    Notice the return code for this is 1, which is what pssh is reporting to you.

    I found this -x -tt trick here. Also note that turning on verbose mode (pssh —verbose) for these cases does nothing to help you.

    It can very much be an ssh-agent issue.
    Check whether there is an ssh-agent PID currently running with eval "$(ssh-agent -s)"

    Check whether your identity is added with ssh-add -l and if not, add it with ssh-add <pathToYourRSAKey>.

    Then try again your ssh command (or any other command that spawns ssh daemons, like autossh for example) that returned 255.

    ### Die on demand with message ###
    die(){
            echo "$@"
            exit 999
    }
    

    I don’t have the rep to comment on Alex’s answer but the exit 999 line returns code 231 on my WSL Ubuntu 20.04.4 box. Not quite sure why that is returned but I understand that it’s out of range.

    1

    Понравилась статья? Поделить с друзьями:
  • Psql ошибка подключиться к серверу через сокет var run postgresql s pgsql 5432 не удалось
  • Psql error fatal peer authentication failed for user zabbix
  • Psql error fatal peer authentication failed for user root
  • Psql error fatal peer authentication failed for user postgres
  • Psql error database does not exist