Is it possible to open a second shell session that will remember the user, machine, and directory I am in?

0

I'm ssh'ed into a machine and logged in as a different user. Is it possible to open a few new windows that will still be ssh'ed into that same machine, still logged in as that user?

Igorio

Posted 2010-09-21T16:13:53.203

Reputation: 688

3Which OS is the local machine and which terminal software are you using? On Windows, using PuTTY, I click the system menu and select Duplicate Session. – Paused until further notice. – 2010-09-21T16:48:08.303

@Ross: Yes, I started answering this assuming you were SSHing from OS X to linux, but I just realized I might have that backwards. – Josh – 2010-09-21T16:51:21.693

1

In your first window you could start GNU Screen and then start as many different things as you want within screen.

– Zoredache – 2010-09-21T17:08:00.230

Oh screen, how I love thee! – Josh – 2010-09-21T17:09:04.437

1excellent, Josh assumed ssh to linux, Nifle assumed ssh to Mac. Either way, problem solved B-) – Brian Postow – 2010-09-21T17:14:41.197

I was being vague as I would like to do this on both linux and macos, in any bash shell connected to any machine I happen to be on. That is a good start Josh, will be handy at work when i'm always on macos. @Zoredache, if screen works as you say, make it an answer and i will accept it. @Dennis, that's very cool and somewhat ironic that a windows app can do that. – Igorio – 2010-09-21T17:34:13.093

1

@Ross: Check out some hidden features of screen -- it's a great program!

– Josh – 2010-09-21T18:28:53.247

Answers

1

Please note, this answer assumes your local machine is OS X, which you didn't specify...

You could set up a Terminal command to do this. From the Terminal menu, choose Preferences.... On the "Settings" tab, either create a new settingh group using the + button, or duplicate one of the setting groups you like. On the "Shell" group of your new settings, enter as the command: ssh user@host, where user and host are real values. Check the "Run inside shell" box.

OS X Terminal Preferences

Now, you can open new windows or tabs by choosing the menu options Shell > New Window > Your setting name or Shell > New Tab > Your setting name.

EDIT: I see you're interested in screen. This is a great program, and I use in all the time. In fact the screenshot above is outdated. What I now have is the one above it, called "Resume Screen". The command for that one is:

ssh -t user@host screen -RR -DD

This will connect to host as user and resume the last screen you were using (detaching it if you're still attached elsewhere). Similar means of setting up a terminal exist on linux. For gnome-terminal, check Edit > Profiles.

Josh

Posted 2010-09-21T16:13:53.203

Reputation: 7 540

0

The easiest way would be to have a local x-server and enable(*) ssh X forwarding. That way you could start any app (including a terminal) remotely and have it displayed locally.

(*) I believe it's turned on by default on most command line ssh clients

Nifle

Posted 2010-09-21T16:13:53.203

Reputation: 31 337