Feature #911
Add IP Address to Pre-Login Console Text on FreeBSD
Description
I recently wanted to add the IP address of my development FreeBSD VMs to the console pre-login prompt, sparing me the time of logging in just to ifconfig
once so I can ssh
into the VM. Unfortunately FreeBSD does not use /etc/issues
like its Linux counterparts, but relies on /etc/gettytab and uses /etc/issue as a shim for text without the use of any macros.
This is how I added the IP address of my machine to the pre-login console prompt on FreeBSD 11.
update-issue script¶
- Create an update-issue script:
vi /usr/local/etc/rc.d/update-issue
- And add the following:
#!/bin/sh # PROVIDE: update-issue # REQUIRE: NETWORKING syslogd # KEYWORD: . /etc/rc.subr IPADDRESSESV4=$(ifconfig em0 | grep inet | awk '{print $2}') for IPADDRESS in $IPADDRESSESV4; do printf "IP: $IPADDRESS" > /etc/issue done; echo "" >> /etc/issue
- And add the following:
- Make the script executable:
chmod +x /usr/local/etc/rc.d/update-issue
- Start and enable the script at boot:
echo 'update_issue_enable="YES"' >> /etc/rc.conf service update-issue start
Resources¶
Updated by Daniel Curtis over 7 years ago
- Description updated (diff)
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Estimated time set to 0.50 h