一半君的总结纸

听话只听一半君

ssh之后如何显示(动态)欢迎信息(motd)?

motd的意思是 Message of the Day,有时候觉得ssh进去之后比较单调,这时候可以设个banner,当然可以在etc/ssh/sshd_config里打开Banner

或者想要“动态/彩色”的,可以这样,放在启动文件里,synology DSM 5.0登录以后没看到哪里有.bashrc, 因为是zsh? 只看到个.profile,于是把下面这一段放进去

echo -e "
      ___           ___           ___           ___           ___           ___
     /\__\         /\  \         /\__\         /|  |         /\__\         /\  \
    /:/ _/_        \:\  \       /:/  /        |:|  |        /:/ _/_       /::\  \
   /:/ /\__\        \:\  \     /:/  /         |:|  |       /:/ /\__\     /:/\:\__\
  /:/ /:/  /    ___  \:\  \   /:/  /  ___   __|:|  |      /:/ /:/ _/_   /:/ /:/  /
 /:/_/:/  /    /\  \  \:\__\ /:/__/  /\__\ /\ |:|__|____ /:/_/:/ /\__\ /:/_/:/__/___
 \:\/:/  /     \:\  \ /:/  / \:\  \ /:/  / \:\/:::::/__/ \:\/:/ /:/  / \:\/:::::/  /
  \::/__/       \:\  /:/  /   \:\  /:/  /   \::/~~/~      \::/_/:/  /   \::/~~/~~~~
   \:\  \        \:\/:/  /     \:\/:/  /     \:\~~\        \:\/:/  /     \:\~~\
    \:\__\        \::/  /       \::/  /       \:\__\        \::/  /       \:\__\
     \/__/         \/__/         \/__/         \/__/         \/__/         \/__/

+++++++++++++++++: System Data :+++++++++++++++++++
+ Hostname = `hostname`
+ Kernel = `uname -r`
+ Uptime = `uptime | sed 's/.*up \([^,]*\), .*/\1/'`
# + CPU = `cat /proc/cpuinfo | grep -i processor | awk '{for(i=3;i<=NF;++i) printf("%s ",  $i) }'`
+ Memory = `cat /proc/meminfo | grep MemTotal | awk {'print $2'}` kB
++++++++++++++++++: User Data :++++++++++++++++++++
+ Username = `whoami`
+ Box Admin = fucker @ Nowhere
+++++++++++++++++++++++++++++++++++++++++++++++++++
"

ascii art那部分是从这里复制来的

实际效果…
motd

当然因为是个可执行命令,你想显示什么信息都可以,比如ip地址,进程数目等等

当然也可以搞成彩色的,看这里 CUSTOMIZE YOUR MOTD – LINUX

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: