0

I've set up an alias in my bashrc so I can access the cluster at work from home. However, to run programmes on it, I'd like to login to my work computer. How do I add that hostname so I can use one alias?

I've tried just extending the alias by alias WORK="ssh user@work; user@hostname", but I still only have access to my files and can't run anything. If I run the second part again once logged in, it then works. home is the same for both if that makes a difference as I tried to add another key.

cianius
  • 2,272
  • 6
  • 28
  • 41
  • what do you exactly intend to do here? you want to login to both work and hostname in a single alias? What is the normal manual sequence you follow to get to your machine? – askmish Oct 21 '12 at 16:13
  • normally I do it one by one. The alias WORK used to be just the first half, but then if I wanted to do more than just access files, I would log into hostname so I could run programes. I would like to log straight into hostname, in a single step (I can't do that without ssh'ing into WORK first). – cianius Oct 21 '12 at 16:21
  • Do you have passwordless logins enabled? – askmish Oct 21 '12 at 16:24
  • yes. I set up the private public key pair. – cianius Oct 21 '12 at 16:32

1 Answers1

0

ssh -A -t user@work ssh -A user@hostname

The -A option enables agent forwarding. The -t option is to force a pseudo-tty to be allocated. Normally, when your ssh command specifies a command to be run on the target host, no pseudo-tty will be allocated. If you want the command to run and then exit you do not need to use the -t option, but if you want an interactive shell session then you'll need a pseudo-tty.

askmish
  • 6,464
  • 23
  • 42
  • This doesn't seem to work. I added in the arguments you gave to my alias, but it's still not an interactive session. – cianius Oct 21 '12 at 16:37
  • To allow passwordless logins you have to install the public key from your home computer into the `~/.ssh/authorized_keys` of each host along the way, to the ultimate destination server, i.e. `hostname` in your case.And what did you mean by session not being interactive? – askmish Oct 21 '12 at 16:43
  • Nope, that didnt work either (I only managed to get back to do this problem now...) – cianius Nov 01 '12 at 12:36