Linux display ipaddres before logon
We build software running on Linux servers (Centos)
We don't want the customer to have access to the Linux server, but the customer sometimes need to know the ipaddress of the server.
So my question is: Is it possible to display the ipaddress at the loginscreen (no graphical i开发者_开发知识库nterface), that means, before the user has logged in?
Michael
Yes, it is possible. If you're talking about a text console, then you just need to create a shell script that executes this command:
/usr/bin/watch -n 60 /sbin/ifconfig > /dev/tty2
Then change /etc/inittab
so that it runs that shell script on tty2
instead of getty
. The user then just has to switch to tty2
with ALT+2 to see the network settings, including IP address.
You can also do it if you have a graphical X login, but it's a little more work.
精彩评论