Created
September 18, 2016 13:57
-
-
Save scompo/c1e781af68f869626b018cec46e2356e to your computer and use it in GitHub Desktop.
Add IP address on login prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# | |
# rc.local | |
# | |
# This script is executed at the end of each multiuser runlevel. | |
# Make sure that the script will "exit 0" on success or any other | |
# value on error. | |
# | |
# In order to enable or disable this script just change the execution | |
# bits. | |
# | |
# By default this script does nothing. | |
BASE_ISSUE_FILE="/etc/issue.base" | |
CURRENT_ISSUE_FILE="/etc/issue" | |
CURRENT_IP_ADDRESS=$(hostname -I) | |
cat $BASE_ISSUE_FILE > $CURRENT_ISSUE_FILE | |
echo "IP Address:" $CURRENT_IP_ADDRESS >> $CURRENT_ISSUE_FILE | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup
Copy original issue file
Execute the following command to copy the original /etc/issue to the new /etc/issue.base
sudo cp /etc/issue /etc/issue.base
Edit rc.local
Edit the /etc/rc.local file with the following command to make it look like this gist
sudo nano /etc/rc.local
Reboot
Reboot the system with the following command
sudo reboot
Check that everything is fine
The machine should reboot showing something like this.