0

Is there a way to avoid ssh login warning messages while login to remote server through scripts? But I do not want to change any configurations in remote server, but in scripts or any options.

5
  • 1
    ssh -q or ssh -q -qdoesn't work for you?
    – January
    Oct 16, 2012 at 8:15
  • What's Python's role in this? Could you be more specific?
    – MeaCulpa
    Oct 16, 2012 at 8:32
  • trying to have a automated ssh login scripts in python,but I do not want to capture the ssh warning messages displayed while login into remote machine.
    – Ganesan Nagasamy
    Oct 16, 2012 at 8:48
  • 1
    Is fixing the cause of the warning message not the better approach? What warning message is it exactly?
    – Jens
    Oct 16, 2012 at 8:56
  • No, Actually that is going to be a security warning messages displayed from remote machines.That is needed from remote machine perspective, but I do not want to capture while login through ssh through my python scripts.
    – Ganesan Nagasamy
    Oct 16, 2012 at 8:59

2 Answers 2

4

If you're trying to suppress warnings coming from the ssh command, you can use the ssh options:

-o 'CheckHostIP no' -o 'StrictHostKeyChecking no' -o 'UserKnownHostsFile /dev/null'

when connecting to test systems that are regularly being reinstalled. This does yield the following warning:

Warning: Permanently added 'hostname' (RSA) to the list of known hosts.

But if you add the -q option, this warning goes away also.

Yes This is horribly dangerous WRT man-in-the-middle attacks, but it is ideal for what we're doing

If you're trying to suppress warnings from the remote system then if it obeys the .hushlogin mechanism, you can use:

touch .hushlogin

on the remote system to suppress the motd (message of the day - which is regularly where the warning messages appear).

1
  • Absolutely 100% agree on bypassing the warnings being a horrible idea. This option should ONLY be used when you are on an internal network with the server in question. Never ever ever over the public internet. Oct 16, 2012 at 14:46
1

Call ssh with the argument:

bash -i

for example:

/usr/bin/ssh [email protected] "bash -i"

It will supress message from the server

You must log in to answer this question.