Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using cygwin in windows 7 to copy a directory to an ubuntu machine using this command.

scp -rp -P 54322 /cygdrive/c/xampp/htdocs/. user@

After copying all the files, they all have "no read, no write" permissions. Does anyone know why?

Alternatively if I copy /cygdrive/c/xampp/htdocs/ to /cygdrive/c/Users/user and then use scp to copy the files. The permissions are correct.

---------- 1 user user 1273 Apr 21 16:32 about.html
---------- 1 user user 1707 Apr 21 16:33 contact.html
d--------- 2 user user 4096 Apr 21 04:14 images
---------- 1 user user 2259 Apr 21 22:27 index.html
---------- 1 user user 1252 Apr 21 16:33 projects.html
---------- 1 user user  823 Apr 22 22:03 style.css
drwx------ 6 user user 4096 Apr 21 02:11 xampp
share|improve this question
can you run ls -l /home/user/somefolder and edit your question so we can see the permissions on the linux side? – Huckle Apr 25 '12 at 4:19
Hello, and thanks for your response. I've added the output of ls -l – Kelbizzle Apr 26 '12 at 21:23
up vote 2 down vote accepted

I've had some issues with rsync/ssh and cygwin, this is how I managed to solve:

  • Disable acl's as these cannot be properly mapped to Linux ACL's
  • Check mount options before changing:

$ mount

D:/ProgramsVista/ICW/etc/terminfo on /usr/share/terminfo type ntfs (binary,noacl)
D:/ProgramsVista/ICW/bin on /usr/bin type ntfs (binary,noacl)                    
D:/ProgramsVista/ICW/lib on /usr/lib type ntfs (binary,auto)                     
D:/ProgramsVista/ICW on / type ntfs (binary,noacl)                               
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)                  
D: on /cygdrive/d type ntfs (binary,posix=0,user,noumount,auto)                  
E: on /cygdrive/e type iso9660 (binary,posix=0,user,noumount,auto)
  • Change setting for ACL's

cp /etc/fstab /etc/fstab.install

echo "none /cygdrive cygdrive binary,posix=0,user,noacl 0 0" >> /etc/fstab

  • To activate the new setting, logout and login again

logout ssh Adminstrator@hostname

  • Check the new setting for "noacl":

$ mount

D:/ProgramsVista/ICW/etc/terminfo on /usr/share/terminfo type ntfs (binary,noacl)
D:/ProgramsVista/ICW/bin on /usr/bin type ntfs (binary,noacl)
D:/ProgramsVista/ICW/lib on /usr/lib type ntfs (binary,auto)
D:/ProgramsVista/ICW on / type ntfs (binary,noacl)
C: on /cygdrive/c type ntfs (binary,noacl,posix=0,user,noumount,auto)
D: on /cygdrive/d type ntfs (binary,noacl,posix=0,user,noumount,auto)
E: on /cygdrive/e type iso9660 (binary,noacl,posix=0,user,noumount,auto)

(sorry can't seem to get the formatting right this morning.)

share|improve this answer
I can confirm this works. After changing the mount options to acl with. "-mount -o /cygdrive/c binary,posix=0,auto,noacl" I'm able to copy the files with SCP over to linux and have the permissions of the ssh account I'm using. If anyone is interested in the learning about the mount command as it relates to cygwin check out. This link – Kelbizzle Apr 28 '12 at 1:58
Thanks for your help Jippie! – Kelbizzle Apr 28 '12 at 2:01

Since you are copying from an NTFS drive (with windows-like permissions) Cygwin is essentially "making up" a set of unix like permissions. As you copy the files to a real unix-based system, those permissions become relevant. Since you are using the -p option on scp, you are retaining the permissions that Cygwin "made up". The receiving system either doesn't have a user with that UID, or at the very least your user account is not the one with that UID, so you do not have permission to even see the permissions.

The easiest way to fix this is to take ownership of the files on the linux side.

chown $(whoami):$(whoami) ~/somefolder -R
chmod 750 -R ~/somefolder/

from the linux desktop, which will give you rwx permssions to the user, rx to the group, and no access to others. Or drop the -p from scp which should use your user account's UMASK to generate new permissions on the unix side

share|improve this answer
I just did a ls -l on the windows machine and the permissions are the same you are correct. SCP is copying the permissions. I created another folder c:\test, copied that, and the permissions are the same. As a test I just created another folder in "c:\Users\user\My/ Documents" , copied that over, and this folder has the correct permissions. It appears to be anything that's not in my users folder doesn't have the permissions for my local user on the windows machine. – Kelbizzle Apr 26 '12 at 21:41
On the windows computer I copied /cygdrive/c/xampp/htdocs/ to /cygdrive/c/Users/user , tried to reproduce the original issue. Everything copied as I had expected. – Kelbizzle Apr 26 '12 at 21:59
Wow, ok, you used 'the same' without really explaining what it was the same as, and then you said you user's folder, but didn't really explain if that was the Linux User or the Windows User... – Huckle Apr 27 '12 at 22:37
I said on the windows machine, I thought that was obvious enough. As for 'the same' I was referring to the permissions of c:\test were the exact same after copying them over to the linux machine. – Kelbizzle Apr 28 '12 at 1:24
Thanks for your help @Huckle – Kelbizzle Apr 28 '12 at 1:59

Use an additional flag. From man scp:

 -p      Preserves modification times, access times, and modes from the original file.
share|improve this answer
He is copying from an NTFS drive so the permissions are likely emulated anyway, not sure if -p would help. – Huckle Apr 26 '12 at 21:25
I actually did use the -p I mistakenly missed it in the OP, I've edited to reflect it. – Kelbizzle Apr 26 '12 at 21:26
That's actually your problem, Cygwin is making up a set of invalid unix permissions to use with the NTFS files. Drop the -p or alternately take ownership of the files on linux – Huckle Apr 26 '12 at 21:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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