0

I tried to scp from an external machine to my machine but failed:

$ scp -rp /home/externaluser/pd/folder myIP:pd/
scp: pd/: File exists

I have checked the permission:

$ ls -l /home/externaluser/
lrwxrwxrwx 1 externaluser externaluser   56 Mar  3 17:42 pd -> /run/media/superuser/external_xfs_hd/pd

And the folder is empty:

$ ll /run/media/superuser/external_xfs_hd/pd
total 0

The strange thing is that if I scp to /home/externaluser then it works:

$ scp -rp /home/externaluser/pd/folder myIP:

Any idea?

Update #1: Followed Danfossi's suggestion to try rsync:

$ rsync -avz -e ssh /home/externaluser/pd externaluser@myIP:/home/externaluser/pd
sending incremental file list
rsync: ERROR: cannot stat destination "/home/externaluser/pd": Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(565) [Receiver=3.0.9]
rsync: connection unexpectedly closed (187 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
$

Here is the info of the mounted external drive:

$ df -T /dev/sdb
Filesystem     Type  1K-blocks  Used  Available Use% Mounted on
/dev/sdb       xfs  1952560720 32992 1952527728   1% /run/media/superuser/external_xfs_hd

It was mounted by nautilus when I clicked on it.

1

Try with rsync:

$ rsync -avz -e ssh /src/dir user@remote.host:dst/dir

or with tar:

$ cd /source_dir
$ tar cf - * | ssh user@remote.host ‘(cd /destination_dir;tar xf - )’
|improve this answer|||||
  • More info but still doesn't work :( – HCSF Mar 3 '19 at 13:59
  • how do you mount the external drive ? I do not remember in what situation but I had a similar writing problem on the mount points under /run. Try to mount the external disk manually on a folder under /mnt – Danfossi Mar 3 '19 at 14:10
  • It was mounted by nautilus when I (as superuser) clicked on it. – HCSF Mar 3 '19 at 14:17
  • just to be sure I would tell you to try to temporarily change the mount point and try again – Danfossi Mar 3 '19 at 14:25
  • 1
    Good that you asked how I mounted. And I checked the permissions of all the parent directories of the mounted drive. Now, I noticed that nautilus used superuser as the owner of /run/media/superuser and set the directory to non executable for everyone except owner and group, causing externaluser not able to stat, which rsync was trying to do. Fixing the permission fixes everything. Thanks a lot for your hint! – HCSF Mar 3 '19 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.