SSH port binding and timing out - some questions
I hope someone can explain to me how this is working, and help with a solution to a question I will ask in a minute!
My company website is hosted on one server (let's call it fileserver) while the mySQL databases that drive the site are on another server (let's say dbserver). Now as far as I can make out, the only host that is allowed to connect to dbserver is fileserver - when I want to connect to the dbserver to make changes to the database, I run the following SSH command on my PC: Quote:
Hope you're still with me so far . . . ! First question is why does the above command need to mention both dbserver and fileserver - surely all I'm doing is binding the port from dbserver to mine - why does the connection need to go through fileserver? Now, I've just set up a new Ubuntu server here, one purpose being to perform a nightly back up of the mySQL database. As the owners of dbserver won't allow my server to connect directly to theirs, I'm stuck using the above command, which isn't a problem except that it times out after ten minutes or so of inactivity. The solution I've thought of to this is to send a command every minute (using cron) to the mySQL server running on 127.0.0.1 (which when port bound IS my remote dbserver) just to keep the SSH connection active. Question is, and I think this is pretty basic, how do I run the above command and then close the terminal session I've opened it in? I'm running Ubuntu server edition so only access to it is through SSH. Hope this makes sense? Thanks a lot, Ed Ludlow PS have tried using SSH keys to connect but apparently the owners of dbserver don't want to allow this. |
You're creating an ssh tunnel through the file server to the dbserver. The dbserver won't allow connections from anywhere else, which is why you cannot just forward a local port directly to the dbserver.
It sounds like there's a firewall between either your client and the fileserver, or the fileserver and the dbserver, or both, that is timing out it's temporary state after inactivity. OpenSSH has some keep-alive options mentioned in the man pages. I think you'll find reading them educational. Code:
$ man ssh |
Thanks chort.
Done a bit of reading since posting that and have found -f which runs the connection in the background. Thanks - having a play with scripts to keep the connection alive now! Ed |
All times are GMT -5. The time now is 01:40 AM. |