kimkong Posted May 23, 2016 Share Posted May 23, 2016 i'm working with the lan turtle and I see a tutorial for Persistent Shell Access with AutoSSH, when I have of lan turtle into a usb port in my pc, the lan turtle work fine, I can connect from my vps to the lan turtle without any problem, but when I activated the Autossh and connect the Lan turtle to external battery for try of connect from my vps to Lan turtle is imposible the connect, I worked with this video https://www.youtube.com/watch?v=uIdvvrDrRj0 but Into the vps he only made a new user, is possible what I need another configuration into my vps for can connect to the lan turtle using autossh Quote Link to comment Share on other sites More sharing options...
Éd_D Posted August 30, 2021 Share Posted August 30, 2021 (edited) I have a problem that looks like… The AutoSSH connection is up on the Turtle. On the VPS, when I try: ssh root@localhost the connection is refused… Edited August 31, 2021 by Éd_D Quote Link to comment Share on other sites More sharing options...
chrizree Posted August 31, 2021 Share Posted August 31, 2021 Did you use the correct port? Quote Link to comment Share on other sites More sharing options...
Éd_D Posted August 31, 2021 Share Posted August 31, 2021 I think that sshd is misconfigured on the vps: root@vps:~# grep ^[^#] /etc/ssh/sshd_config Port 2222 PermitRootLogin no ChallengeResponseAuthentication no UsePAM yes PrintMotd no AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server PasswordAuthentication yes root@vps:~# (When commissioning, I only uncommented the Port directive, changed 22 to 2222 on this ligne and changed yes to no for the PermitRootLogin directive…) Quote Link to comment Share on other sites More sharing options...
chrizree Posted August 31, 2021 Share Posted August 31, 2021 Was that default settings or did you change the file yourself? Why add the vps to 2222? Quote Link to comment Share on other sites More sharing options...
Éd_D Posted August 31, 2021 Share Posted August 31, 2021 2 hours ago, chrizree said: Did you use the correct port? I tried both: turtle@vps:~$ ssh root@localhost ssh: connect to host localhost port 22: Connection refused turtle@vps:~$ ssh -p 22 root@localhost ssh: connect to host localhost port 22: Connection refused turtle@vps:~$ ssh -p 2222 root@localhost root@localhost's password: Permission denied, please try again. root@localhost's password: Permission denied, please try again. root@localhost's password: ^C turtle@vps:~$ Quote Link to comment Share on other sites More sharing options...
chrizree Posted August 31, 2021 Share Posted August 31, 2021 I think you have mixed something up and made settings that isn't needed (or shouldn't be there). 2222 has nothing to do with the local sshd on the vps. Just skip any settings for the local sshd on the vps and see it from the Turtle perspective. 1 Quote Link to comment Share on other sites More sharing options...
Éd_D Posted August 31, 2021 Share Posted August 31, 2021 (edited) 3 hours ago, chrizree said: Was that default settings or did you change the file yourself? Why add the vps to 2222? In fact, I have changed the ssh port (22) by a custom one (port number chosen between 49152 and 65535) for security reason. When I copy commands and screen output on the forum, I write 2222 instead the real l number because "2222" look nice as customed ssh number… 🙂 Edited August 31, 2021 by Éd_D Quote Link to comment Share on other sites More sharing options...
Éd_D Posted August 31, 2021 Share Posted August 31, 2021 (edited) On the LAN Turtle, AutoSSH is running: root@turtle:~# ps […] 28771 root 936 S /usr/sbin/autossh -M 20000 -i /root/.ssh/id_rsa -N -T -R xxxxx:localhost:22 turtle@vps.domain.tld -p 22 […] root@turtle:~# (Debian man page about autossh [https://manpages.debian.org/bullseye/autossh/autossh.1.en.html] is not complete enough to understand all the command line arguments.) From here, everything looks ok. No problem with the ssh connection to the VPS. Edited August 31, 2021 by Éd_D Quote Link to comment Share on other sites More sharing options...
chrizree Posted August 31, 2021 Share Posted August 31, 2021 With the autossh module stopped in the Turtle "text based GUI", try running the following directly from the terminal on the Turtle (change user@address to something relevant for your setup and ports as well, if not "default") autossh -M 20000 -i /root/.ssh/id_rsa -R 2222:localhost:22 user@address -p 22 -N -T If that works (it should), change the following line in /etc/turtle/modules/autossh from: uci set autossh.@autossh[0].ssh="-i /root/.ssh/id_rsa -N -T -R "$autossh_remoteport":localhost:"$autossh_localport" "$autossh_host" -p "$autossh_port" " to: uci set autossh.@autossh[0].ssh="-i /root/.ssh/id_rsa -R "$autossh_remoteport":localhost:"$autossh_localport" "$autossh_host" -p "$autossh_port" -N -T" Furthermore... to get the module itself working, change the lines in the "configure" function of the autossh module from: autossh_host=$(uci show autossh.@autossh[0].ssh | awk '{print $7}' | sed "s/'//g") autossh_port=$(uci show autossh.@autossh[0].ssh | awk '{print $9}' | sed "s/'//g") autossh_remoteport=$(uci show autossh.@autossh[0].ssh | awk '{print $6}' | sed 's/:/ /g' | awk '{print $1}') autossh_localport=$(uci show autossh.@autossh[0].ssh | awk '{print $6}' | sed 's/:/ /g' | awk '{print $3}') to: autossh_host=$(uci show autossh.@autossh[0].ssh | awk '{print $5}' | sed "s/'//g") autossh_port=$(uci show autossh.@autossh[0].ssh | awk '{print $7}' | sed "s/'//g") autossh_remoteport=$(uci show autossh.@autossh[0].ssh | awk '{print $4}' | sed 's/:/ /g' | awk '{print $1}') autossh_localport=$(uci show autossh.@autossh[0].ssh | awk '{print $4}' | sed 's/:/ /g' | awk '{print $3}') Also change the line in the "start" function of the autossh module from: autossh_host=$(uci show autossh.@autossh[0].ssh | awk '{print $7}' | sed 's/@/ /g' | awk '{print $2}') to: autossh_host=$(uci show autossh.@autossh[0].ssh | awk '{print $5}' | sed 's/@/ /g' | awk '{print $2}') Done! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.