landscape-sysinfo是一个非常不错的工具,能让你在ssh连接到系统时,直观看到系统基本信息(如下)

test@wklls:~$ ssh [email protected]
[email protected]'s password: 

Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-154-generic x86_64)

  System information as of Mon Jul 22 09:49:24 CST 2019

  System load:               0.93
  Usage of /:                15.3% of 458.22GB
  Memory usage:              65%
  Swap usage:                2%
  Processes:                 349
  Users logged in:           1
  IP address for enp2s0:     192.168.31.252

  => There are 2 zombie processes.

  Graph this data and manage this system at:
    https://landscape.canonical.com/

ubuntu下使用非常方便,sudo apt-get install ​​landscape-sysinfo就行

家里有一台kali的系统,没办法apt-get方式安装,花了些时间折腾完成安装

开源代码位置:https://github.com/CanonicalLtd/landscape-client

安装过程如下(整理版,如处理完成后,未能正常,自行检测是不是漏了相关库)

git clone https://github.com/CanonicalLtd/landscape-client.git
cd landscape-client

sudo setup.py install

#安装完成后,可以使用landscape-sysinfo命令了,但却没有结果

#再进行下以方式安装相关的库
sudo apt-get install build-essential python3-dev libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev python3-distutils-extra

sudo pip3 install twisted
sudo pip3 install netifaces
sudo pip3 install configobj

安装时如报错:from DistUtilsExtra.command import build_extra,则

sudo apt-get install python-setuptools python-distutils-extra

处理登录ssh提示文字

sudo vim /etc/update-motd.d/50-landscape-sysinfo
#输入以下内容

#!/bin/sh
cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
[ "$cores" -eq "0" ] && cores=1
threshold="${cores:-1}.0"
if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then
    echo
    echo -n "  System information as of "
    /bin/date
    echo
    #注意 landscape-sysinfo 的路径要对应上你本机的路径
    /usr/bin/landscape-sysinfo
else
    echo
    echo " System information disabled due to load higher than $threshold"
fi

保存后,chomd 755 /etc/update-motd.d/50-landscape-sysinfo

这时再ssh登录到系统,就能看到不一样的信息了!