Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

5 Answers 5

up vote 20 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

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
1  
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

Your Answer

 
discard

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