Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

New Terminal tab same ssh connection

How do I open a new terminal tab so that it opens the same remote ssh connection as my current tab?

MacBook Pro, Mac OS X (10.6.8)

Posted on Jul 12, 2011 3:01 PM

Reply
4 replies

Jul 12, 2011 4:10 PM in response to x5150

ssh connections are a single process running in one shell, and when you create a new tab you are creating a new local shell that will not be running this process. Furthermore the remote server will not accept a duplicate connection from you without authentication. In essence, this is impossible to do. The closest thing you can do is make use of the bash history, and press the up arrow to scroll through your most recent commands until you get to the ssh command you used for your current connection, and then execute it.


If the connection is a standard one you regularly use, then you can bookmark it in your .bashrc file by creating a function that points to it. For instance, the following in your .bashrc file would make a specific ssh connection be run by entering "myserver" at the command line:



function myserver() {
     ssh username|password@hostname
}


You can leave out the password option to have it prompt you for the password each time (it is also more secure to leave out the password).

Jul 12, 2011 8:19 PM in response to Topher Kessler

The new tab and establish same connection is a standard feature in the ssh client I use for windows. The company that makes the software is now called Tectia. It's gui based, where you would setup accounts and store the login info in the app. You would enter the password once and then could open a new tab that would just be another remote connection. You could also then just click 'Open File Transfer Window' and you would have an sftp gui without entering anymore login information. So I'm looking for the same type of app on mac or how to get that functionality because I need many many terminals open to tail different logs, etc. I can see the bashrc functions being useful but see a problem when I'm trying to remember the function name for 50 different servers instead of seeing a list in a gui.

Jul 12, 2011 9:20 PM in response to x5150

Ah...if the client manages the connection then that will work; however, in OS X's terminal does not support this. The most the OS X terminal will do is store the server in the connections window (press command-K to see this) but it does not automatically manage them. The only way to do this in the OS X Terminal is by creating a shortcut to establish the connection.

New Terminal tab same ssh connection

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.