Remote: -R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side. Ssh -L sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the local sourcePort to port onPort on the machine called forwardToHost, which can be reached from the connectToHost machine. Local: -L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. The machine, where the ssh tunnel command is typed is called »your host«. So this will be an "ssh connection within another ssh connection".Ĭonsider that if the first ssh-connection will timeout and/or fall down for whatever reason (including: killed by local firewall, due to inactivity), you'll be unable to remote-forward/remotely_connect Īs it's important to leave the first ssh connection active for really long time, you might find useful to launch such ssh within a " screen" sessionĪ final note: Obviously, all of the above has some (potentially serious) security implications that are out of scope of this answer. is binded to the previous ssh connection. SERVER_B:~ $ ssh -p 2222 ssh-connection, launched on SERVER_B, will be directed to the 2222 port listening on localhost that. LINUX_BOX_A:~ $ ssh -R 2222:localhost:22 will open an ssh connection from LINUX_BOX_A to SERVER_B that will be used for the remote, incoming, connection.Īfter above ssh connection is established, you can: The only condition is: LINUX_BOX_A MUST be able to connect via SSH to SERVER_B. SSH remote forwarding can be used to reach LINUX_BOX_A from SERVER_B. a Linux server B (SERVER_B) with a fixed IP that is accessible from the internet.a Linux box A (LINUX_BOX_A) inside a LAN behind a firewall.Made to host port hostport from the local machine. Side, and whenever a connection is made to this port, theĬonnection is forwarded over the secure channel, and a connection is This works by allocating a socket to listen to port on the remote Specifies that the given port on the remote (server) host is toīe forwarded to the given host and port on the local side. Even with a really stable internet connection, I doubt a year is possible.īTW - unlike these other jokers, I know this works, since I actually tested it because of course I'm doing something similar and since I have it working now, very reliably, I can give you the correct answer.What you're referring is "SSH REMOTE FORWARDING", and is properly explained in the " man ssh", regarding the " -R" option. Using autossh, if the connection fails, it will reconnect and restart the sleep again. If you do not run a command, ssh will connect, setup the reverse tunnel on port 2205, and when it's done with that, it will exit. During this time, your tunnels will remain up. Sleep 31536000 tells ssh to run "sleep" for 1 year after connecting. f places it in the background, but placing it in the background means that ssh will connect, then disconnect as soon as it's completed its task. You need to use -f and run a command when you run without a terminal. I have referred many answers hence but none of them seemed to help. There are many similar questions on this website on my issue. Please be kind enough to help me spot my mistake. I then installed a chrontab a several minutes before the current time and waited for it to execute. I also tried these as a normal user, still they didn't work. Here are the cronejobs I tried as roots cronejobs. I can see this because when I check this proxy from Google Chrome, it says proxy is refusing connection. However when I install the chrontab in the following method, My ubuntu PC never makes a Dynamic proxy. rev.sh in my Ubuntu terminal I obtain a dynamic proxy and also access to ym DigitalOcean server. The certificate "digitalOcean" and rev.sh is located in Ubuntu home. Note: rev.sh file contains the above line. In order to solve this problem I installed the following crontab. autossh -CD 8080 -i digitalOcean -R 8081:localhost:22 is no way I can run thsi script again on my office PC upon a restart as I am not physically there. I run the following script to make the reversed connection + dynamic proxy to anonymise my traffic ( As I am not required to share browsing information) generated at the office PC. In these kind of cases, I am unable to connect from my home PC to my office PC. I utilise this reversed SSH connection from home to login to my office PC (I am authorised to do so) and copy files and do other important things.Īlthough not often, I noticed that my office PC restarts (due to power failures etc) and breaks the reversed SSH connection it has made with my VPC. I have a PC behind a NAT which makes a reverse SSH connection to my Digitalocean VPC.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |