Overview: SSH modifies line endings when using command in authorized_keys. I'm using keys to ensure that an unattended copy occurs while using the command="aScript.php" that outputs an uncompressed tarball. Because of the line endings changing, my tarball becomes invalid. What happens: When using public/private keys to force a particular command to run, under tested circumstances, LF is converted to CRLF. Running the same command without using a forced command returns the correct text. Steps to reproduce: cd ~ echo this is a test > bugcheck.txt echo It needs to have multiple lines >> bugcheck.txt echo so that I can check if there is a bug >> bugcheck.txt echo in OpenSSH >> bugcheck.txt ssh-keygen -t rsa -f bugcheck -N "" echo -n "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command=\"cat bugcheck.txt\" " >> ~/.ssh/authorized_keys cat bugcheck.pub >> ~/.ssh/authorized_keys ssh localhost 'cat bugcheck.txt' > bugcheck-response-1.txt ssh -i bugcheck localhost > bugcheck-response-2.txt ls -l bugcheck-response-*.txt Actual Results: -rw-r--r-- 1 codewarrior codewarrior 96 Nov 10 11:12 bugcheck-response-1.txt -rw-r--r-- 1 codewarrior codewarrior 100 Nov 10 11:12 bugcheck-response-2.txt (bugcheck-response-2.txt contains CRLF line endings) Expected Results: -rw-r--r-- 1 codewarrior codewarrior 96 Nov 10 11:12 bugcheck-response-1.txt -rw-r--r-- 1 codewarrior codewarrior 96 Nov 10 11:12 bugcheck-response-2.txt (bugcheck-response-2.txt should have original LF line endings) Build Date and Platform: OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006 on RedHat Enterprise Linux 5 Additional Builds and Platforms OpenSSH_5.1p1, OpenSSL 0.9.8h 28 May 2008 on Gentoo Linux
It's probably the pty layer not sshd that's doing the translation. Try "ssh -T localhost" or "ssh localhost foo" instead.
Ah, you're very right. -T does fix the problem. Sorry for troubling you. --Steven P.S. (I'm a bit new to bug trackers, How do you go about closing bugs?)
That's quite ok, glad it's working for you. Closing.
Close bugs fixed/reviewed for openssh-5.2 release