Customizing the Message of the Day (MOTD)

Virtuozzo Server can display an informative message, known as the message of the day (MOTD), when a user logs in to the server. As a root user, you can customize the MOTD according to your needs, for example, to show a greeting, important system information, current resource consumption, or something else.

The vz-motd service generates the message of the day from the contents of the /etc/motd_user and /etc/motd files. The steps to customize these files differ depending on whether you want the MOTD to show static or dynamic information. They are described in the following sections.

Setting a Custom Static MOTD

To set the MOTD to display static information, for example, a greeting, do the following:

  1. Add the desired text to the /etc/motd_user file. For example:

    1
    
    echo 'Welcome to Virtuozzo Server' >> /etc/motd_user
    
  2. Restart the Virtuozzo Server MOTD service:

    1
    
    systemctl restart vz-motd
    

On the next successful login, you will see the following static message of the day:

1
Welcome to Virtuozzo Server

Setting a Custom Dynamic MOTD

To set the MOTD to display dynamic information, for example, the current Virtuozzo Server release and kernel versions as well as license status, do as follows:

  1. Create the /etc/vz/ifup.d directory and a shell script with a custom name in it, for example, motd.sh:

    1
    2
    
    mkdir /etc/vz/ifup.d
    vi /etc/vz/ifup.d/motd.sh
    
  2. Add the following lines to the script:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    #! /bin/bash
    
    echo -e "
    Welcome to `cat /etc/virtuozzo-release`
    vzkernel: `uname -r`
    License:
    `vzlicview | grep -E "(status|expiration)"`
    " >> /etc/motd
    chmod 644 /etc/motd
    
  3. Make the script executable:

    1
    
    chmod 755 /etc/vz/ifup.d/motd.sh
    
  4. Restart the Virtuozzo Server MOTD service:

    1
    
    systemctl restart vz-motd
    

On the next successful login, you can see a message of the day similar to the following:

1
2
3
4
5
Welcome to Virtuozzo Server release 7.0.9 (469)
vzkernel: 3.10.0-862.20.2.vz7.73.25
License:
    status="ACTIVE"
    expiration="02/15/2019 02:59:59"