简体   繁体   中英

Suppress welcome message on bash remote command execution

I'm executing some commands on remote server within a shell script like this:

ssh user@host <<ENDSSH
...
ENDSSH

Upon login I'm getting a standard server welcome message echoed. Is there a way to send it to \\dev\\null but to keep displaying the output of executed commands?

Thanks.

Create a file ~user/.hushlogin on the remote host. This will suppress output from the login program when user logs in (such as time of last login and any message of the day).

You can edit /etc/ssh/sshd_config (for debian/ubuntu, your server might be different file) and turn the following setting to 'no'.

 PrintMotd no
 PrintLastLog no

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM