[Bug 2800] New: sftp fails to connect when login shell is t/csh and user's .cshrc generates output

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Wed Nov 22 02:09:05 AEDT 2017


https://bugzilla.mindrot.org/show_bug.cgi?id=2800

            Bug ID: 2800
           Summary: sftp fails to connect when login shell is t/csh and
                    user's .cshrc generates output
           Product: Portable OpenSSH
           Version: 5.3p1
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: trivial
          Priority: P5
         Component: sftp-server
          Assignee: unassigned-bugs at mindrot.org
          Reporter: david.t.kerns at gmail.com

If the user's login shell is either tcsh or csh and their .cshrc
outputs any characters the sftp fails with the message:

Received message too long xxxxxxx

The work-a-round is for the user to wrap any generated output in the
following if clause:

if ( `tty` != 'is not a tty' ) then
  echo safe to echo
endif

However, I believe a better solution would be to exec the sftp-server
app with the -f argument to the t/csh so that the user's .cshrc file is
never sourced.

The following shows the difference between a sftp session with a login
shell of bash vs csh:

root         2017     1  0 Nov08 ?        00:00:00 /usr/sbin/sshd
root        21480  2017  0 07:44 ?        00:00:00 sshd: usera [priv] 
usera       21484 21480  0 07:44 ?        00:00:00 sshd: usera at notty  
usera       21485 21484  0 07:44 ?        00:00:00
/usr/libexec/openssh/sftp-server


root      3307     1  0 May15 ?        00:00:00 /usr/sbin/sshd
root     16260  3307  0 14:47 ?        00:00:00 sshd: userb [priv]
userb    16267 16260  0 14:47 ?        00:00:00 sshd: userb at notty
userb    16268 16267  0 14:47 ?        00:00:00 csh -c
/usr/libexec/openssh/sftp-server
userb    16288 16268  0 14:47 ?        00:00:00
/usr/libexec/openssh/sftp-server

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list