#611380 openssh-client: sftp's put -r fails with "Unable to canonicalise path"

Package:
openssh-client
Source:
openssh
Description:
secure shell (SSH) client, for secure access to remote machines
Submitter:
"brian m. carlson"
Date:
2014-12-09 06:21:04 UTC
Severity:
normal
#611380#5
Date:
2011-01-28 16:03:04 UTC
From:
To:
When I use the command line sftp client and try to use "put -r", I get
the error 'Unable to canonicalize path "/home/bmc/foodir"'.  I suppose
that is because the directory in question does not exist (that's why I'm
uploading it).  A normal put works just fine, but obviously that doesn't
work for directories.  Also, using "put -r" works if the destination
directory (below, /home/bmc/foodir) already exists.  scp works fine.

Both machines are running Debian amd64/sid using GSSAPI authentication
(which works fine since I'm able to do an ls).  If there's something
that you'd like me to test, please let me know.

Transcript:

  bmc@lakeview:/tmp
  (2011-01-28/15:50:19)(pts/9)(ac+99%)(ok)
  lakeview ok % sftp castro
  Connected to castro.
  sftp> ls
  Maildir             bin                 checkouts           emul                patches             procmail.log        public_html
  share               telemarketers       tmp                 version-controlled  workspaces          writings
  sftp> put -r foodir
  Uploading foodir/ to /home/bmc/foodir
  Couldn't canonicalise: No such file or directory
  Unable to canonicalise path "/home/bmc/foodir"
  sftp> ^D

#611380#10
Date:
2011-05-21 03:06:52 UTC
From:
To:
I can confirm this bug.

I am attempting to upload files onto my webserver using sftp.  As far as I can
tell from reading the man pages and searching online, the correct syntax once
connected via sftp is:

put -r *

I keep getting the, "Unable to Canonicalise"  error.

This is a fundamental need out of an sftp program.  Is there a scheduled fix
for this?  Is there anything I can do to help?

#611380#15
Date:
2012-06-20 10:43:43 UTC
From:
To:
Seems that sftp does not support recursive coping. Some people recommend use:

  $ rsync --delete --rsh=ssh -av $LOCAL $HOST:$REMOTE

or:

  tar -cf - $LOCAL | ssh $HOST " ( cd $REMOTE ; tar -xf - )"

Look for discussion:

http://unix.stackexchange.com/questions/7004/uploading-directories-with-sftp

#611380#20
Date:
2012-06-20 10:46:59 UTC
From:
To:
Also note that:

http://blog.naoar.com/2012/04/sftp-recursive-option-not-working-huh.html

workaround problem by creating destination dir firstly.

#611380#25
Date:
2014-12-09 06:19:32 UTC
From:
To:
direct use of put -r not possible... directories are needed to be created
first...problem solved...


cheers
-Aakash :-)