[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

SSH file transfer doesn't handle filenames with blanks

Hello List,

To my great amazement, scp refused to copy filenames with blanks or worse
characters (like an ampersand '&') in it.  Is that a bug in SSH?

$ scp 'localhost:archiv/music/Sonata Arctica/Silence/12_Wolf & Raven.ogg'
bash: line 1: Raven.ogg: command not found

It seems like scp forgot to properly protect the argument from
interpretation by the remote shell.

$ scp 'localhost:archiv/music/Sonata\ Arctica/Silence/12_Wolf\ \&\
Raven.ogg' .

Works OK with the /bin/bash at the remote end, though too much work for my

The account 'archiv' is configured to use shell scponly.

$ scp 'archiv@localhost:music/Sonata\ Arctica/Silence/12_Wolf\ \&\
Raven.ogg' .
invalid characters in scp command!
here:&\ Raven.ogg
try using a wildcard to match this file/directory

scponly dislikes even correctly escaped ampersands (probably in good
faith), at least proposing a workaround.

In short, scp does not a very good job of hiding the remote shell process
from the user.

>From what I can see, scp should be fixed to auto-escape shell
metacharacters when they occurr in filenames.  Furthermore, scponly should
be enhanced to let escaped metacharacters pass through.

Any comments before I'm filing bugs?

Best Regards,  | This signature is currently under construction.
 Sebastian     | Please check back later!
               | mailbox in "From" silently drops any mail > 20k

Reply to: