2

im using ubuntu 14.04 and i edited grub so that it boots into text mode

i want to display a message in the login screen like this:

 _            _   
| |_ ___  ___| |_ 
| __/ _ \/ __| __|
| ||  __/\__ \ |_ 
 \__\___||___/\__|

login:

i also want to run this command so when user runs the os in VM it displays the ip address in the login screen :

ifconfig | perl -nle 's/dr:(\S+)/print $1/e'

is there a file should i edit ? i want to do it like ssh Banner and welcome message

k961
  • 263
  • 1
  • 3
  • 11

1 Answers1

1

For your ASCII art

Edit the file /etc/issue

sudo nano /etc/issue

and add your ASCII Art.


Add system information with:

  • b Insert the baudrate of the current line.
  • d Insert the current date.
  • s Insert the system name, the name of the operating system.
  • l Insert the name of the current tty line.
  • m Insert the architecture identifier of the machine, e.g., i686.
  • n Insert the nodename of the machine, also known as the hostname.
  • o Insert the domainname of the machine.
  • r Insert the release number of the kernel, e.g., 2.6.11.12.
  • t Insert the current time.
  • u Insert the number of current users logged in.
  • U Insert the string "1 user" or " users" where is the number of current users logged in.
  • v Insert the version of the OS, e.g., the build-date etc.

eg:

Ubuntu 15.04 \n

for the hostname


For the IP address

  1. Create a file /etc/issue-standard and add your ASCII art.

  2. Create a script /etc/network/if-up.d/show-ip-address

    sudo nano /etc/network/if-up.d/show-ip-address
    

    add the code below

    #!/bin/sh
    if [ "$METHOD" = loopback ]; then
        exit 0
    fi
    
    # Only run from ifup.
    if [ "$MODE" != start ]; then
        exit 0
    fi
    
    cp /etc/issue-standard /etc/issue
    LANG=C sudo /sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print $2 }' >> /etc/issue
    echo "" >> /etc/issue
    

    and make the script executable

    sudo chmod +x /etc/network/if-up.d/show-ip-address
    

When the network interface is brought up, the file /etc/issue will be rewritten.

Partial source

A.B.
  • 90,397