Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress welcome message on bash remote command execution

Tags:

bash

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.

like image 215
user487772 Avatar asked Sep 28 '22 19:09

user487772


2 Answers

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

like image 102
chepner Avatar answered Dec 16 '22 10:12

chepner


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
like image 38
Dan Avatar answered Dec 16 '22 11:12

Dan