Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a vps for my website hosting. It is running a ubuntu server. Every time I logged in my server by ssh, it displays a lengthy welcome message in my terminal.

Linux node61.buyvm.net 2.6.18-pony6-3 #1 SMP Tue Mar 13 07:31:44 PDT 2012 x86_64

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Wed Jul 11 12:08:19 2012 from 113.72.193.52 Linux node61.buyvm.net 2.6.18-pony6-3 #1 SMP Tue Mar 13 07:31:44 PDT 2012 x86_64

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. entered into CT 17323 -bash-4.2#

After doing some researches about this(yes i was just googling around), I realized that my server should have a .bashrc and .bash_profile (or .profile) controlling this. I use vim to open my .bashrc and .profile and I couldn't seem to find any line of codes that would display message in my terminal. Therefore I am wondering if there is like another file for this?

I want to comment out those welcome message because my sftp is not working with an error (Received message too long 761422195). I am pretty sure that this error is caused by my server's welcome message.

Sorry for my bad English. I would really appreciate any help!

share|improve this question

migrated from stackoverflow.com Jul 12 '12 at 8:37

This question came from our site for professional and enthusiast programmers.

2  
askubuntu.com/questions/100052/… – alfasin Jul 12 '12 at 4:40
    
Thank you alfasin I am going to try this. – Yansuck Jul 12 '12 at 4:42
up vote 45 down vote accepted

You need to edit two files:

  1. /etc/motd (Message of the Day)
  2. /etc/ssh/sshd_config: Change the setting PrintLastLog to "no", this will disable the "Last login" message.
share|improve this answer
4  
Changing PrintLastLog to NO have nagative impact on security. @RodyOldenhuis give better answer. – Igor S. Nov 9 '14 at 18:56
    
His answer was completely fine. It does explain how to change the login message. – Alex Solon Mar 8 at 23:42

You need to change the contents of /etc/motd. Unfortunately, by default, /etc/motd is a link to /var/run/motd which gets reset every time you login. To make permanent changes, plase do the following:

sudo rm /etc/motd
sudo nano /etc/motd

or whatever editor you prefer. Then enter the message you want shown (if any), and save the file.

Removing the "last seen" message (e.g., setting PrintLastLog to no in /etc/ssh/sshd_config) is not recommended -- time of last login is valuable security information. It allows for a way to check if someone you did not expect has logged into the system recently. Anyway, it's possible of course, but do so knowingly.

share|improve this answer

On a per-user basis, you can run touch ~/.hushlogin to disable the messages.

share|improve this answer

Create a new file and edit the welcome message. Edit /etc/ssh/sshd_config. In that there will be a line called

#Banner /some/path

Edit that path with the newly created welcome message path.

Like,

Banner /var/www/welcome.msg

Restart ssh. Now it 'll work.

share|improve this answer
2  
This does not remove the motd message, only appends the contents of /var/www/welcome.msg before that (at least on Ubuntu 12.04) – Akseli Palén Sep 5 '13 at 8:25

Could be modifying the /etc/issue file, try this:

Current date: \d Current time: \t System name: \s Architecture: \m OS build info: \v Hostname: \n Kernel: \r Number of logged-in users: \u.

share|improve this answer

Create the file /etc/motd.tail and write there everything you need. The file /etc/motd will be generated upon every system boot based on the contents of /etc/motd.tail.

share|improve this answer

A program which helps you displaying a welcome message

  1. Start your terminal
  2. write --> vi filename.sh
  3. press i to go into the insert mode.
  4. Start coding
clear
d=$(date +%H)
if [ $d -lt 12 ]
then
  echo "Good Morning"
elif [ $d -lt 16 ]
then
   echo "Good Afternoon"
elif [ $d -lt 20 ]
then
  echo "Good Evening"
else 
  echo "Good Night"
fi
  1. press esc key after completion

  2. now press shift+q together

  3. write wq and press ENTER \YOUR FILE HAS BEEN SAVED
  4. you have moved now into the terminal
  5. write sh filename.sh
  6. Get your welcome message
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.