Pseudo-tty allocation and -T option
Markus Friedl
markus.friedl at informatik.uni-erlangen.de
Thu Nov 30 18:02:08 EST 2000
try the patch or
ssh host dummy
instead of
ssh host
-markus
Index: ssh.c
===================================================================
RCS file: /home/markus/cvs/ssh/ssh.c,v
retrieving revision 1.74
diff -u -r1.74 ssh.c
--- ssh.c 2000/11/23 21:03:47 1.74
+++ ssh.c 2000/11/30 07:00:38
@@ -504,15 +504,15 @@
if (buffer_len(&command) == 0)
tty_flag = 1;
+ /* Force no tty*/
+ if (no_tty_flag)
+ tty_flag = 0;
/* Do not allocate a tty if stdin is not a tty. */
if (!isatty(fileno(stdin))) {
if (tty_flag)
fprintf(stderr, "Pseudo-terminal will not be allocated because stdin is not a terminal.\n");
tty_flag = 0;
}
- /* force */
- if (no_tty_flag)
- tty_flag = 0;
/* Get user data. */
pw = getpwuid(original_real_uid);
On Wed, Nov 29, 2000 at 03:23:00PM -0000, John Horne wrote:
> Hello,
>
> I've set up a cron job to use ssh with a remote forced command to delete the
> contents of a directory. System A has the cron job and uses a specific key
> for system B. No command as such is specified since the key on system B
> specifies 'command=/bin/rm -rf ...'. However, I am getting error messages
> back from the cron system (or rather from ssh) about it not allocating a tty
> since there is no controlling terminal - obviously not since the job is run
> through cron:
>
> Pseudo-terminal will not be allocated because stdin is not a terminal.
>
> I have tried using the -T option and specifying no_pty in the
> key options on system B, but I still get the error message. The man page for
> ssh says:
>
> -T Disable pseudo-tty allocation (protocol version 2 only).
>
> We are only using protocol 2; openssh 2.3.0p1. So is '-T' not working
> correctly, am I doing something wrong or is openssh correct in that it will
> always print out the message if used via cron? If the latter then how can I
> 'remove' the message since the output gets mailed back to the user (in this
> case the postmasters). I have thought about using:
>
> ssh .... 2>&1 | egrep -v "^Pseudo-terminal will not be"
>
> which seems to work but seems a bit messy. Using '-q' to ssh makes no
> difference either. My understanding from the man page is that -T should
> prevent it attempting to allocate a tty.
>
> Thanks for any help,
>
> John.
>
> ------------------------------------------------------------------------
> John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
> E-mail: jhorne at plymouth.ac.uk
> PGP key available from public key servers
>
More information about the openssh-unix-dev
mailing list