Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make an SSH connection to another server with forwarding, but without having to log on to the remote server, nor interfere with the screen I am working on. I also need to access the connection to terminate it when I finish with it.

eg. say I want to do a mysql backup on a remote server so I use the command ssh user@remote -L 1234:localhost:3306 but after issuing the password I want to run the mysql command in the session, but be able to access the SSH connection when I finish with mysql and terminate it.

Is there some way this can be done?

share|improve this question

migrated from stackoverflow.com Oct 25 '12 at 18:08

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

GNU screen, it should be installed on all Linux boxes by default.

http://www.gnu.org/software/screen/

Here is a good starters guide.

http://www.kuro5hin.org/story/2004/3/9/16838/14935

share|improve this answer
    
answer is a bit short, perhaps you can add a brief summary of the guide – FredrikD Oct 26 '12 at 6:32
    
I think I have to explain myself better. It is all being done from the same window/screen automatically. I shouldn't have to switch to another Window or screen. Both the SSH command and the Mysql command should run from the same command line without switching. – vfclists Oct 26 '12 at 10:48

You could write a script with AutoHotKey to open the window, run the command(s) and then minimize the window for you to deal with later.

share|improve this answer
    
I am running Linux via SSH. It isn't Windows – vfclists Oct 25 '12 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .