[問題] ssh跟motd的幾個問題

看板Linux作者 (一步一腳印)時間12年前 (2011/09/22 22:17), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/1
1. 我想 ssh 到遠端伺服器時不顯示 motd 但我沒有root權限 這樣該怎麼弄? (我希望只影響到我一個人 也就是其他user依然可看到motd) (目前我的替代方案是: ssh -t user@remote_host 'clear; bash -login' 但這方法的缺點是會把螢幕內容整個清空 連我不想清空的部分也是) [補充: 已找到解法] 法一 touch ~/.hushlogin 法二 ssh -t user@remote_host 'bash -login' 法三(推薦這個, 僅在motd與上次登入不同時才顯示) 在.bashrc中加入: cmp -s $HOME/.hushlogin /etc/motd; if [ $? != 0 ]; then tee $HOME/.hushlogin < /etc/motd; fi; ref: http://kb.iu.edu/data/acdd.html 2. 我ssh到 A 工作站後 這個檔案會自動產生: ~/.cache/motd.legal-displayed 它是一個size為零的空檔案 但我ssh到 B 工作站時不會產生這個檔案 我比較了A跟B的/etc/ssh/sshd_config 發現內容相同 這樣為什麼ssh到A會產生這個檔案 ssh到B卻不會呢? 另外 要怎麼避免產生這個檔案? 3. user@remote_host:~$ exit logout Connection to remote_host closed user@local_host:~$ 有辦法設定成exit後不顯示黃色那兩行嗎? how? [補充: 已找到解法] 法一 在.bashrc中加入: alias ssh='ssh -q' [[ `echo $(shopt|grep login_shell)` =~ 'on' ]] && alias exit='logout' -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.31.155

09/22 22:34, , 1F
這個似乎是你的SSH client的訊息....
09/22 22:34, 1F
"這個"=?

09/23 07:25, , 2F
"這個"=那兩行黃色的
09/23 07:25, 2F
恩恩 ※ 編輯: Holocaust123 來自: 140.112.31.155 (09/23 08:08)
文章代碼(AID): #1EUqDq7N (Linux)