2017-04-19 88 views
1

當我通過SSH連接到基於Ubuntu的Docker容器時,每次都會顯示以下消息。禁用ssh消息

The programs included with the Ubuntu system are free software; 
the exact distribution terms for each program are described in the 
individual files in /usr/share/doc/*/copyright. 

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by 
applicable law. 

我想禁用顯示它,但我找不到如何。
有什麼辦法可以做到嗎?如果可能的話,請告訴我如何。

+0

只需閱讀:https://askubuntu.com/a/100058 –

回答

0

我的回答:

sed -i 's/PrintLastLog yes/PrintLastLog no/' /etc/ssh/sshd_config 
touch /home/$USER/.hushlogin 

我需要PrintLastLog沒有和.hashlogin在主目錄。

0

從技術上講,您可以使用以下命令使它們消失。 只需將該消息轉發給文件,然後在註銷時將其刪除即可。

ssh -t [email protected] '> dis.txt; bash -l' 

注意-t選項是執行bash命令所必需的。

但是這會要求輸入密碼。上面和純粹的東西的更簡化版本是使用sshpass。

sshpass -p 'password' ssh -t [email protected] '> dis.txt; bash -l' 

上面的一個很簡單,它只是簡單的連接。

記得更換'密碼'和'用戶'和主機地址。

註銷之前只需插入下面的命令

rm dis.txt 

實際上並不需要最後一步是由你來決定。

參見本:現在How can I disable greeting message when ssh in to a server?