This MOTD has so many colors! This thing is from hell.
It's colourful. It shows a lot. It's fun. But I guess we have reached the limit. The execution is sometimes too slow. It makes it annoying when you log in. So be careful. I warned you.
The most of the icons in this preview are from Font Awesome 5 Pro. I also used fontello to create some own icons.
-
Check the dependencies. Some modules require
jq
, the banner needsfiglet
. Install them. -
Copy
motd-on-acid.sh
to~/.bashrc_motd
on your system. -
Run
motd-on-acid
at the end of your.bashrc
. Add the modules as arguments. The output is ordered in the same way. -
Replace the predefined values with your own. The complete list of vars is at the top of the script.
# example snippet for your .bashrc:
source ~/.bashrc_motd
BANNER_KERNEL_ICON="X"
BANNER_UPTIME_ICON="Y"
BANNER_DEBIAN_ICON="Z"
bash_motd --banner --processor --memory
If you use the example above you will get some problems.
-
You only want to see
motd-on-acid
if you login withssh
on an interactive shell. -
You need a way to disable it sometimes.
The result would look like this:
# example snippet for your .bashrc:
if [ -n "$SSH_CONNECTION" ] && [ $SHLVL -eq 1 ] && [[ $- == *i* ]]; then
if [ -z "$MOTD" ] || [ "$MOTD" -ne 0 ]; then
source ~/.bashrc_motd
BANNER_KERNEL_ICON="X"
BANNER_UPTIME_ICON="Y"
BANNER_DEBIAN_ICON="Z"
bash_motd --banner --processor --memory
fi
fi
Also add AcceptEnv MOTD
to your /etc/ssh/sshd_config
.
Now you can run export MOTD=0; ssh -o SendEnv=MOTD -t host.name.net
to disable MOTD.
That is useful if you run ssh
commands in scripts.
You still have disturbing output which is not required.
Change some values in your /etc/ssh/sshd_config
:
PrintMotd no
PrintLastLog no
Banner none
Disable or remove all pam_motd.so
PAM includes in /etc/pam.d/sshd
# session optional pam_motd.so
Prints a figlet
banner, linux distribution, kernel version and uptime.
Prints the loadavg threshold and hardware info.
Prints a usage bar for your memory.
Prints a usage bar as summary for your swap space.
Prints a usage bar for all mounted filesystems.
Prints the status of a defined list of systemd services.
The default file is .bashrc_motd_services.txt
.
It should look like the example. The separator is;
.
- The printed name [required]
systemd
service name [required]dpkg
orrpm
package name for version info [not required, will print--
if empty]
OpenSSH;ssh;openssh-server
Webserver;nginx
Prints the status of your local podman
containers.
You have to add podman
to the /etc/sudoers
for your user:
username ALL=(ALL) NOPASSWD: /usr/bin/podman version --format json
username ALL=(ALL) NOPASSWD: /usr/bin/podman images --format json
username ALL=(ALL) NOPASSWD: /usr/bin/podman pod ls --sort name --format json
Prints the status of your local docker
containers.
You have to add curl
to the /etc/sudoers
for your user:
username ALL=(ALL) NOPASSWD: /usr/bin/curl -sf --unix-socket /var/run/docker.sock http\:/v1.40/info
username ALL=(ALL) NOPASSWD: /usr/bin/curl -sf --unix-socket /var/run/docker.sock http\:/v1.40/containers/json?all=true
Prints your available linux distribution updates.
apt
and dnf
is supported at the moment.
Prints the expiration status of all your certs. Don't forget to set the path to your cert.
You have to add find
and openssl
to the /etc/sudoers
for your user:
username ALL=(ALL) NOPASSWD: /usr/bin/find </your/path/to/ssl> -name cert.pem
username ALL=(ALL) NOPASSWD: /usr/bin/openssl
Prints the previous login time, logout time and IP of your current user.
Create your own script and print it on your MOTD!