-n vs batch_mode vs batch_flag

Markus Friedl markus.friedl at informatik.uni-erlangen.de
Sun Apr 8 22:28:33 EST 2001


i did not invent '-n' but the manpage reads:

     -n      Redirects stdin from /dev/null (actually, prevents reading from
             stdin).  This must be used when ssh is run in the background.  A
             common trick is to use this to run X11 programs on a remote ma-
             chine.  For example, ssh -n shadows.cs.hut.fi emacs & will start
             an emacs on shadows.cs.hut.fi, and the X11 connection will be au-
             tomatically forwarded over an encrypted channel.  The ssh program
             will be put in the background.  (This does not work if ssh needs
					     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             to ask for a password or passphrase; see also the -f option.)
	     ^^^^^^^^^^^^^^^^^^^^^			   ^^^^^^^^^^^^^


On Fri, Apr 06, 2001 at 08:11:11PM +0900, Tom Holroyd wrote:
> How is -n supposed to work?  When you say ssh -n, it sets stdin_null_flag
> but not batch mode.  When the client is choosing authmethods, there is a
> batch_flag that is tested to see (presumably) if we are in batch mode or
> perhaps if -n has been given.  But nothing sets it.  It looks like it's
> supposed to point to options.batch_mode, but it's never even initialized!
> 
> Even if it did point to batch_mode, that's independent of -n, so when you
> say -n it still (tries to) ask for a password.
> 
> 	% ssh -n localhost &
> 	[1] 5220
> 	% tomh at localhost's password:
> 	[1]  + Suspended (tty input)         ssh -n localhost
> 
> It seems to me that -n (without -f) should mean "stdin doesn't exist, so
> don't try any authmethods that ask for passwords from stdin", which would
> imply that it should set batch_mode too, and batch_flag should point to
> that. Or maybe batch_mode should be checked instead of batch_flag.
> 
> Or is this all supposed to be handled somehow by ssh-askpass (which is
> currently only used by ssh-agent)?
> 
> Thanks,
> 
> Dr. Tom
> 



More information about the openssh-unix-dev mailing list