mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/selfhosting-blogposts.git
synced 2025-05-16 12:16:59 +00:00
109 lines
2.8 KiB
Markdown
109 lines
2.8 KiB
Markdown
---
|
|
search:
|
|
exclude: true
|
|
---
|
|
# Colored MOTDs Setup
|
|
|
|

|
|
|
|
In this tutorial we're going to take a look at how to setup a colorful MOTD anytime you wish to ssh into your machines
|
|
|
|
## **Initial Setup**
|
|
|
|
First install the required dependencies:
|
|
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/22 ] [~]
|
|
→ sudo apt install imagemagick openjdk-17-jdk coreutils perl git
|
|
|
|
|
|
|
|
Then clone the Util-Say repository:
|
|
|
|
|
|
git clone https://github.com/maandree/util-say
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools]
|
|
→ git clone https://github.com/maandree/util-say
|
|
Cloning into 'util-say'...
|
|
remote: Enumerating objects: 2216, done.
|
|
remote: Total 2216 (delta 0), reused 0 (delta 0), pack-reused 2216
|
|
Receiving objects: 100% (2216/2216), 700.67 KiB | 1.67 MiB/s, done.
|
|
Resolving deltas: 100% (854/854), done.
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools]
|
|
→ cd util-say
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools/util-say]
|
|
→ make
|
|
|
|
#you need to type make in order to generate the util-say.jar file that the scripts are using.
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools/util-say]
|
|
→ ls -lash img2ponysay
|
|
4.0K -rwxr-xr-x 1 nothing nothing 582 May 28 16:20 img2ponysay
|
|
|
|
|
|
|
|
here the file we're looking for is called img2ponysay
|
|
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools/util-say]
|
|
→ cat img2ponysay
|
|
#!/usr/bin/env bash
|
|
|
|
magnified='1'
|
|
file='-'
|
|
dash=0
|
|
chroma=1
|
|
c=0
|
|
platform=xterm
|
|
|
|
for arg in "$@"; do
|
|
if [ $c = 1 ]; then
|
|
c=0
|
|
chroma="$arg"
|
|
elif [ $dash = 1 ]; then
|
|
file="$arg"
|
|
elif [ "$arg" = "--" ]; then
|
|
dash=1
|
|
elif [ "$arg" = "-2" ]; then
|
|
magnified=2
|
|
elif [ "$arg" = "-c" ]; then
|
|
c=1
|
|
elif [ "$arg" = "-p" ]; then
|
|
platform=linux
|
|
else
|
|
file="$arg"
|
|
fi
|
|
done
|
|
|
|
java -jar "$(dirname "$0")/util-say.jar" \
|
|
--import image --magnified $magnified --file "$file" --balloon n --export ponysay --balloon y --file - --chroma "$chroma" --platform $platform
|
|
|
|
|
|
|
|
Next we're going to use a relatively small image to convert to our motd:
|
|
|
|

|
|
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools/util-say]
|
|
→ ./img2ponysay -- ~/Pictures/smallzero.png > motd.txt
|
|
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools/util-say]
|
|
→ cat motd.txt
|
|
|
|
|
|
|
|
As you can see, a tiny image can make a very large motd, and you need to be careful of the size of the image you choose to put as your MOTD:
|
|
|
|

|
|
|
|
|
|
[ 10.10.14.13/23 ] [ /dev/pts/26 ] [~/Tools/util-say]
|
|
→ cp motd.txt /etc/motd
|
|
|
|
|
|
|