1

I want to run a bash script (as root) that among other things establishes reverse SSH tunnel using autossh. The SSH key has a passphrase.

  1. Ideally I would like to have to login as root in terminal and the passphrase would be retrieved from a keyring (the computer has Gnome), or something like this, and supplied to autossh (if needs be I can set SSH passphrase and the root password to be the same).

  2. If #1 is absolutely impossible I can do two things - (a) login and (b) run ssh-agent /bin/bash and then provide the passphrase ssh-add.

However even manual input of the passphrase as mentioned in #2 doesn't work. If I run ssh-agent/ssh-add (as mentioned above), SSH itself works:
ssh -f -N -T -R 8888:localhost:22 -p 9999 tunnel@example.org But:
autossh -M 7777 -f -N -T -R 8888:localhost:22 -p 9999 tunnel@example.org doesn't work.

How can I troubleshoot #2 and then ideally implement also #1?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.