Saturday, June 4, 2016

update motd on ubuntu

motd (message of the day ) is message that display after we do the login.

1- to update motd in ubuntu we only create or update file in directory  /etc/update-motd.d/ and assign right permission.

--- so i create two file with the following content
  - /etc/update-motd.d/11-custom-text
#!/bin/sh
printf "\n if you are not authorized stuff, logout before cops drag you to jail.\n"


  -  /etc/update-motd.d/12-custom-text
#!/bin/sh
printf "\n got it? \n"


2- assign execute permission to both file

$ sudo chmod 755  /etc/update-motd.d/11-custom-text 
$ sudo chmod 755  /etc/update-motd.d/12-custom-text 

3- so when you logout and login again you will greeted with our newly added message

- screenshot of motd


- if you don't want to logout/login to see the message you can use update-motd to see weather our newly added motd display or not
$ sudo apt-get install update-motd
$ sudo update-motd
[sudo] password for tin:
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

 if you are not authorized stuff, logout before cops drag you to jail.

 got it?




No comments:

Post a Comment