bugzilla-daemon at bugzilla.mindrot.org
2008-Nov-10 07:19 UTC
[Bug 1536] New: SSH modifies line endings when using command in authorized_keys
https://bugzilla.mindrot.org/show_bug.cgi?id=1536
Summary: SSH modifies line endings when using command in
authorized_keys
Product: Portable OpenSSH
Version: 5.1p1
Platform: ix86
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: sshd
AssignedTo: unassigned-bugs at mindrot.org
ReportedBy: codewarrior at binaryvibrance.net
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
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2008-Nov-10 07:55 UTC
[Bug 1536] SSH modifies line endings when using command in authorized_keys
https://bugzilla.mindrot.org/show_bug.cgi?id=1536
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dtucker at zip.com.au
--- Comment #1 from Darren Tucker <dtucker at zip.com.au> 2008-11-10
18:55:24 ---
It's probably the pty layer not sshd that's doing the translation. Try
"ssh -T localhost" or "ssh localhost foo" instead.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2008-Nov-10 09:19 UTC
[Bug 1536] SSH modifies line endings when using command in authorized_keys
https://bugzilla.mindrot.org/show_bug.cgi?id=1536 --- Comment #2 from Steven Picken <codewarrior at binaryvibrance.net> 2008-11-10 20:19:55 --- 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?) -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2008-Nov-10 10:01 UTC
[Bug 1536] SSH modifies line endings when using command in authorized_keys
https://bugzilla.mindrot.org/show_bug.cgi?id=1536
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
--- Comment #3 from Darren Tucker <dtucker at zip.com.au> 2008-11-10
21:01:29 ---
That's quite ok, glad it's working for you. Closing.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-Feb-23 02:36 UTC
[Bug 1536] SSH modifies line endings when using command in authorized_keys
https://bugzilla.mindrot.org/show_bug.cgi?id=1536
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #4 from Damien Miller <djm at mindrot.org> 2009-02-23
13:36:34 ---
Close bugs fixed/reviewed for openssh-5.2 release
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
Seemingly Similar Threads
- [Bug 2042] New: Troubleshooting information should be logged when sshd doesn't have permission to read user's authorized_keys file
- [Bug 220] New: sshd fails to read other users authorized_keys over nfs as root
- Cygwin: store authorized_keys in /etc/ssh/user/authorized_keys?
- splitting big authorized_keys files
- [Bug 1947] New: Log authorized_keys format issues and refuse to accept keys