One of your login scripts (.bashrc/.cshrc/etc.) is probably outputting data to the terminal (when it shouldn't be). This is causing ssh to error when it is connecting and getting ready to copy as it starts receiving extra data it doesn't expect. Remove output that is generated in the startup scripts.
You can check if your terminal is interactive and only output text by using the following code in a bashrc. Something equivalent exists for other shells as well:
if shopt -q login_shell; then
[any code that outputs text here]
fi
or alternatively, like this, since the special parameter -
contains i
when the shell is interactive:
if echo "$-" | grep i > /dev/null; then
[any code that outputs text here]
fi
For more information see: rsync via ssh from linux to windows sbs 2003 protocol mismatch
To diagnose this, make sure that the following is the output you get when you ssh in to the host:
USER@HOSTNAME's password:
Last login: Mon Nov 7 22:54:30 2011 from YOURIP
[USER@HOSTNAME ~]$
If you get any newlines or other data you know that extra output is being sent. You could rename your .bashrc/.cshrc/.profile/etc. files to something else so that they won't output extra output. Of course there is still system files that could cause this. In that case, check with your sysadmin that the system files don't output data.
You can use:
> /var/log/mail.log
That will truncate the log without you having to edit the file. It's also a reliable way of getting the space back.
In general it's a bad thing to use rm
on the log then recreating the filename, if another process has the file open then you don't get the space back until that process closes it's handle on it and you can damage it's permissions in ways that are not immediately obvious but cause more problems later on.
Yasar has a nice answer using truncate
Also if you are watching the contents of the log you might like to use the tail
command:
tail -f /var/log/mail.log
Ctrl-C will break off the tailing.
Best Answer
Most of the information you want will be in
/var/log/dmesg
and/var/log/messages
after the system boots, you should check those files first.Generally linux machines run mingetty for the virtual terminals. If you have a traditional sysv init system, those are controlled by
/etc/inittab
. You can add the--noclear
option to mingetty to prevent clearing the screen. To do this, edit/etc/inittab
and change this line:to
then reboot the machine.
Some newer linux distros use init replacements like Upstart (for example, Ubuntu). These generally don't use /etc/inittab and instead use some other config files. Here's a discussion of how calling mingetty works on Ubuntu.