dangerous behaviour of scp
Jacques Bouchard
jacques.bouchard at onera.fr
Wed Dec 8 22:21:17 EST 2004
When you require a scp copy of more than 1 file to a destination that is
not a directory, scp copy the last input file to the destination
(version openssh-3.8.1p1).
Thus if you forget to specify the destination, the last file is
_silently destroyed_.
I know that rcp exhibits the same behaviour but cp and rsync don't do
anything in that case and _kindly_ warn you that you made a mistake:
cp: copying multiple files, but last argument `<file>' is not a directory
Try `cp --help' for more information.
ERROR: destination must be a directory when copying more than 1 file
rsync error: errors selecting input/output files, dirs (code 3) at
main.c(371)
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)
Why not that user-friendly behaviour for scp, which shouldn't make the
same mistakes as rcp?
A user who is sad to have lost data with a "secure" command.
More information about the openssh-unix-dev
mailing list