B
B
BigD2010-11-13 20:54:51
SSH
BigD, 2010-11-13 20:54:51

Autostart ssh under screen, in Ubuntu in the background before user login?

Hello.
There is such a command that establishes an SSH tunnel:
/usr/bin/ssh -D LocalIP:1080 -i aws.pem [email protected] -p 443
It is necessary that the tunnel be started automatically before the user login, as a service.
I put the following in rc.local before exit 0:
/usr/bin/screen -d -m /usr/bin/ssh -D LocalIP:1080 -i aws.pem [email protected] -p 443
Permissions - 755.
And if I I just run this command in the console, ssh will be screened in the background.
But it does not work on reboot, screen -list says that there are no sessions.
Please help, I don't understand what I'm doing wrong.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
habrrich, 2010-11-13
@BigD

sudo crontab -e -u your_username
@reboot /usr/bin/screen -d -m /usr/bin/ssh -D LocalIP:1080 -i aws.pem [email protected] -p 443

A
amgorb, 2010-11-13
@amgorb

put this command in your .bash_profile in your root directory!
Sounds harsh, but it works :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question