[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: command execution upon ssh



nori heikkinen <nori@sccs.swarthmore.edu> writes:

> i want to ssh to a remote machine (firewall), and then immediately
> upon success, ssh to another remote machine.  i don't want to put this
> in my .login, because i don't want it to always happen -- i want to be
> able to *just* ssh to the first box, too, or have the option of going
> through to the 2nd.

I'd do 'ssh -t machine1 ssh machine2'.

> it seems this should have to do with the '-n' option for ssh.

>From ssh(1):

     -n      Redirects stdin from /dev/null (actually, prevents
             reading from stdin).  This must be used when ssh is run
             in the background.

I do occasionally find this useful, but it means that you will be
unable to interact with the ssh session, which isn't what you want at
all.

> however (here's the problem), i can't type in the resultant terminals.

...because you've told ssh that you don't want to be able to, with
-n.  Try leaving that out.

(As the man page notes, -nf are useful options for running remote X
applications; for pseudo dual-head operation at work, for example, I
do 'ssh -nf laptop x2x -to :0.0 -east' all the time.  ssh asks me for
a password, then backgrounds itself, and I never hear from it again in
spite of the X forwarding continuing to work.)

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: