ssh script returns 255 error

前端 未结 8 771
北海茫月
北海茫月 2020-12-08 04:04

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

相关标签:
8条回答
  • 2020-12-08 05:02

    As @wes-floyd and @zpon wrote, add these parameters to SSH to bypass "Are you sure you want to continue connecting (yes/no)?"

    -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
    
    0 讨论(0)
  • 2020-12-08 05:05

    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?

    0 讨论(0)
提交回复
热议问题