Debian autossh boot script not working properly

2,030

ssh exited with error status 255 usually points out authentication or connectivity issues. Try running your autossh without -f option so you can see its output:

autossh -M 0 -N -o \"ServerAliveInterval 60\" -o \"ServerAliveCountMax 3\" -R 11111:localhost:22222 -i /home/username/.ssh/id_rsa -p 3333 user@server_ip

Out of autossh manual:

Note that there is a crucial a difference between -f with autossh, and -f with ssh: when used with autossh ssh will be unable to ask for passwords or passphrases.

You can also try passing -v or -vv options to ssh to help your debug:

autossh -M 0 -N -vv -o \"ServerAliveInterval 60\" -o \"ServerAliveCountMax 3\" -R 11111:localhost:22222 -i /home/username/.ssh/id_rsa -p 3333 user@server_ip

Also, please note that /usr/lib/autossh/autossh is the process that monitors your ssh session, and restarts it if required. If your autossh command it's working you should be able to see both autossh and ssh process:

$ps -eo user,pid,args | grep ssh
----------
someuser    16384  /usr/lib/autossh/autossh -M 33332    -N -R 11111:127.0.0.1:22222 serverip
someuser    16385  /usr/bin/ssh -L 33332:127.0.0.1:33332 -R 33332:127.0.0.1:33333 -N -R 11111:127.0.0.1:22222 serverip

And btw, you don't need to pass the -f option to ssh, autossh will start it in background, by default.

Share:
2,030

Related videos on Youtube

Harish
Author by

Harish

Developer actually using C# and SQLAnywhere but with long experience with Delphi.

Updated on September 18, 2022

Comments

  • Harish
    Harish almost 2 years

    I started working on an iPhone application (XCode 5 and iOS 7). I am not sure why when I run my app, it's hiding my Navigation Bar's title and back button. Here are some screen shots.

    If you look closely, something is hiding the title and back button. Not sure what?

    enter image description here

    enter image description here

    • bneely
      bneely almost 11 years
      I would start by setting backgroundColor on some of the views to see if they are where you expect.
    • Harish
      Harish almost 11 years
      Looks okay. I tried setting the content inset as well. Still the same
    • bneely
      bneely almost 11 years
      Are you using a nib for your view controller? If not, how are you constructing the view?
    • Harish
      Harish almost 11 years
      yes, I am using storyboards
    • bneely
      bneely almost 11 years
      Try the visual view debugging options mentioned here: cocoanetics.com/2011/05/visual-view-debugging
    • wurtel
      wurtel over 9 years
      Note that the manpage states The -f flag is stripped from arguments passed to ssh.
    • vaindil
      vaindil over 9 years
      @wurtel I did see that, but it should still appear in the process list, shouldn't it? The process list shows the autossh command, not the ssh command. (Honest question, not saying you're wrong.)
    • wurtel
      wurtel over 9 years
      It's showing /usr/lib/autossh/autossh, not /usr/bin/autossh. It doesn't pass the -f option to this helper process. Have you checked syslog for messages from autossh?
    • vaindil
      vaindil over 9 years
      @wurtel syslog is showing ssh exited with error status 255; restarting ssh for each autossh line, even though running the individual commands just as ssh works correctly. That error is returned whether the script is run or if I run the line from the script directly in bash.
  • Jakob Bennemann
    Jakob Bennemann over 9 years
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.
  • Anthon
    Anthon over 9 years
    I changed your "comment" to a potential answer, stating your questions as assumptions. Please flesh out the answer by providing the description of the known configuration issues, possible supported with some external links.
  • Jakob Bennemann
    Jakob Bennemann over 9 years
    @Lambert It doesn't take long to build up the rep needed. In the future, restrain yourself from such posts until you do have the rep. That's the point.
  • Lambert
    Lambert over 9 years
    @HalosGhost, I get your point, but (just curious) why do you think my answer is not the right one? I tried to help the author with another possibility since issues on private/public keys are common.
  • Jakob Bennemann
    Jakob Bennemann over 9 years
    Now that it has been rewritten as an answer, I don't mind it at all.