Ubuntu 18.04 show IP on login prompt /etc/issue
- cp /etc/issue /etc/issue.bak
- vi /etc/network/if-up.d/update-issue
-
#!/bin/sh # Add IP and MAC to /etc/issue VERSION=$(cat /etc/issue.net) IPADDR=$(hostname -I | tr " " "\n" | grep -v "^$" | sort -t . -k 1,1n | head -1 | tr "\n" " ") MAC=$(cat /sys/class/net/*/address | head -n 1) echo "$VERSION \\\n \\l $IPADDR $MAC\n" > /etc/issue
-
- chmod 0755 /etc/network/if-up.d/update-issue
test
- /etc/network/if-up.d/update-issue
- cat /etc/issue