Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The server I administrate, inconveniently enough, has a dynamic IP address assigned by DHCP. The convenient counterbalance, though, is that it happens to be set up about two feet from where I sit. I know how to edit /etc/issue to show different values before the login prompt is delivered to the display, but I'd like to know if it's possible for /etc/issue to display the current IP address of eth0 (re-evaluated at boot time) so that I can see it and then ssh in without having to log in to run ifconfig.

share|improve this question
    
Can conky be used in the login screen? If so you could make all sorts of info handy. –  dibs Nov 15 '12 at 1:07

1 Answer 1

up vote 4 down vote accepted

/etc/issue is unfortunately a plain text, it has some options you can add to it (see man agetty) but not the IP Address of eth0..

If you put this in /etc/rc.local:

IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
echo "eth0 IP: $IP" > /etc/issue

Then you will see something like this:

eth0: 192.168.0.2
myServer login:
share|improve this answer
    
Works flawlessly! Thanks. –  ssonicblue Nov 16 '12 at 7:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.