All Projects → x70b1 → motd-on-acid

x70b1 / motd-on-acid

Licence: Unlicense license
This MOTD has so many colors!

Programming Languages

shell
77523 projects

Labels

Projects that are alternatives of or similar to motd-on-acid

aic-bash
A bash script to query our API for public domain artworks and render them as ASCII art
Stars: ✭ 65 (+41.3%)
Mutual labels:  motd
Arch-MOTD
Arch-MOTD (Message of the day)
Stars: ✭ 28 (-39.13%)
Mutual labels:  motd

motd-on-acid

Codecheck GitHub contributors license

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.

Preview

motd-on-acid

The most of the icons in this preview are from Font Awesome 5 Pro. I also used fontello to create some own icons.

Setup

  1. Check the dependencies. Some modules require jq, the banner needs figlet. Install them.

  2. Copy motd-on-acid.sh to ~/.bashrc_motd on your system.

  3. Run motd-on-acid at the end of your .bashrc. Add the modules as arguments. The output is ordered in the same way.

  4. 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

Make it better

If you use the example above you will get some problems.

  1. You only want to see motd-on-acid if you login with ssh on an interactive shell.

  2. 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.

Remove other output

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

Modules

--banner

Prints a figlet banner, linux distribution, kernel version and uptime.

--processor

Prints the loadavg threshold and hardware info.

--memory

Prints a usage bar for your memory.

--swap

Prints a usage bar as summary for your swap space.

--diskspace

Prints a usage bar for all mounted filesystems.

--services

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;.

  1. The printed name [required]
  2. systemd service name [required]
  3. dpkg or rpm package name for version info [not required, will print -- if empty]
OpenSSH;ssh;openssh-server
Webserver;nginx

--podman

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

--docker

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

--updates

Prints your available linux distribution updates. apt and dnf is supported at the moment.

--letsencrypt

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

--login

Prints the previous login time, logout time and IP of your current user.

--include

Create your own script and print it on your MOTD!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].