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 sftp or scp to do file transfers to CAE's tux lab machines (including best-tux) or 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 (.cshrc, .login, .bashrc, .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 svn+ssh to best-tux.cae.wisc.edu

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.




Keywords:tcsh bash shell non interactive sftp connection closed scp svn svn+ssh ssh   Doc ID:12081
Owner:Ken H.Group:Computer-Aided Engineering
Created:2009-09-02 19:00 CDTUpdated:2016-05-24 14:11 CDT
Sites:Computer-Aided Engineering
Feedback:  8   7