Unix: SFTP Login Fails
Some users experience "Connection closed" messages when attempting to use sftp, scp, svn+ssh or other ssh tunneled services if their profile contains errors.
Note that the # character at the beginning of each command line is not part of the command and should not be included in the command.
When attempting to use
scp to do file transfers to CAE's tux lab
sftp.cae.wisc.edu, some users may experience
Connection closed errors after a successful login. The cause of
this is usually an error in the user's profile (
.bash_profile, etc.) files. For non-interactive sessions such as SFTP or SCP,
your profile must not print anything either explicitly or in error.
Note, this issue also applies to other services wrapped in an SSH session, like
To prevent this be sure that the top of your
.cshrc file includes
a return call such as the following:
# # Please do not remove the following line. This file sets up your # environment the way it is supposed to be. You can add your own # features if you know what you are doing. # if ( -f /.cshrc_global ) source /.cshrc_global if (! $?prompt) exit 0
Or, if you're using the bash shell, the top of your
.bashrc file should contain the following:
# # Please do not remove the following line. This file sets up your # environment the way it is supposed to be. You can add your own # features if you know what you are doing. # [ -f /.bashrc_global ] && source /.bashrc_global [ -z "$PS1" ] && return
Running the CAE accountfixer (
accountfixer.pl) will also setup
these files correctly.
In all cases, you may need to logout before these changes will take effect.