I like VMware Fusion a lot. It’s a great tool to run various OS’s on my Mac. Even though the Mac underlying BSD like system works well for most of what I do, every once in a while having access to a native Linux environment is hard to beat. One issue that can be annoying is working in a bare bones Linux VM via the VMware console. It is not much fun, requiring manual mouse release and lacking cut and paste between host and VM. The easiest way to resolve this is to use ssh. However, what is the IP address of the VM? And oh, after months of not having used it, what is the login?

Here it comes, /etc/issue to the rescue! Let’s display our IP address and login credentials at the login prompt. I am using the Linux VM in a walled garden environment, security is of little concern here. I am using this in Debian Wheezy. Other dittos may require slight changes…

Make a copy of our /etc/issue file.

cp /etc/issue /etc/issue-orig

Create the file /etc/network/if-up.d/show-ip

if [ "$METHOD" = loopback ]; then
    exit 0

# Create /etc/issue with IP
myip=`/sbin/ifconfig | grep "inet addr" | grep -v "" | awk '{ print $2 }' | awk -F: '{ print $2 }'`

cp /etc/issue-orig /etc/issue
echo "IP Address:   $myip" >> /etc/issue
echo "Login:        root/test" >> /etc/issue
echo "              user/test" >> /etc/issue
echo "" >> /etc/issue

Make sure the file is executable

chmod 755 /etc/network/if-up.d/show-ip

And that’s it. Now lease, if your login credentials are root/test and user/test you may really want to consider updating the /etc/network/if-up.d/show-ip script with your actual values.