ssh-copy-id assumes $HOME

Bug #686671 reported by Tom Vaughan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
portable OpenSSH
Unknown
Unknown
openssh (Debian)
Fix Released
Unknown
openssh (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

ssh-copy-id assumes that the default working directory on the remote machine will be $HOME. In some cases the login scripts on the remote machine change the working directory to something other than $HOME. The patch below should solve this (not widely tested):

--- ssh-copy-id.orig 2010-12-07 09:36:20.297263103 -0800
+++ ssh-copy-id 2010-12-07 09:37:15.226054626 -0800
@@ -38,7 +38,7 @@
   exit 1
 fi

-{ eval "$GET_ID" ; } | ssh ${1%:} "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1
+{ eval "$GET_ID" ; } | ssh ${1%:} "umask 077; cd $HOME; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1

 cat <<EOF
 Now try logging into the machine, with "ssh '${1%:}'", and check in:

Changed in openssh (Debian):
status: Unknown → New
Changed in openssh (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks for your report. This was actually fixed upstream a little while back, in OpenSSH 5.6p1:

20100618
 - (djm) [contrib/ssh-copy-id] Update key file explicitly under ~
   rather than assuming that $CWD == $HOME. bz#1500, patch from
   timothy AT gelter.com

The packages in Natty contain this fix.

Changed in openssh (Ubuntu):
status: Confirmed → Fix Released
Changed in openssh (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.