Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 16 '12 at 11:48

This question came from our site for professional and enthusiast programmers.

1  
ssh -q or ssh -q -qdoesn't work for you? –  January Oct 16 '12 at 8:15
    
What's Python's role in this? Could you be more specific? –  MeaCulpa Oct 16 '12 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 '12 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 '12 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 '12 at 8:59
add comment

2 Answers

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).

share|improve this answer
    
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. –  UtahJarhead Oct 16 '12 at 14:46
add comment

Call ssh with the argument:

bash -i

for example:

/usr/bin/ssh root@10.8.13.59 "bash -i"

It will supress message from the server

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.