Reverse ssh - apalis imx6 linux

Hello,

I am running a 3G connection via ppp0 and would like to reverse ssh into my apalis imx6 linux

I am running the below command on Apalis
ssh -NR *:2222:localhost:22 {myPC_username}@{IP address from whatsmyip.com}

then on the PC I try
ssh -p 2222 localhost

but I get an error “ssh: connect to host localhost port 2222: Connection refused”

I can however ssh into my Apalis via “ssh root@apalis_ip”

can you please guide me about this?
thanks
rifo

Hi

It works here, at least with a local Ethernet connection and the latest image.

Albeit I had to provide the user ‘root’ I want to connect to when using the reverse tunnel, as I’m not logged in as root on the PC.

root@colibri-imx6:~# ssh -NR *:2222:localhost:22 tdx@192.168.10.1                 
Password:                                                                       

.

tdx@tdx:~> ssh -p 2222 root@localhost
Last login: Sun Jun  4 14:14:24 2017 from ::1
root@colibri-imx6:~# root@colibri-imx6:~# ps ax | grep ssh 
  678 ttymxc0  S+     0:00 ssh -NR *:2222:localhost:22 tdx@192.168.10.1
  679 ?        Ss     0:00 sshd: root@pts/0
  687 pts/0    R+     0:00 grep ssh

Max

hello,

I guess the problem was that my ISP somehow didn’t make the routing correctly.
I changed the reverse IP address to a linode server and everything worked just fine.

However I have another problem now. I tried to automate the reverse ssh command via systemd.

My resolv.conf file keeps being overwritten. I tried chattr command but it fails. Can you please guide me?

root@apalis-imx6:~# chattr -i /etc/resolv.conf
chattr: Operation not supported while reading flags on /etc/resolv.conf

As the comment in /etc/resolv.conf says, it is managed by the Connection Manager. What is it what you want to change in resolv.conf? To add nameservers you should use connman built-in mechanism, e.g. use the nameservers argument when configuring the connection as documented here: http://developer.toradex.com/knowledge-base/ethernet-network-(linux)#Connman

Thanks, I was following the Toradex 3G/4G connection tutorial and came across that command. I will switch to connection manager as you suggest.