Permissions not set for 'other' when copying from Windows

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Permissions not set for 'other' when copying from Windows

john doe
Hi,

I'm trying to understand why a copied file from 'C:\' into
/home/user/try doesn't have the permissions set for 'other' (see below).

The following will create a file named 'try.txt':

PS C:\> new-item try.txt -itemtype file


    Directory: C:\


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        12/17/2018  04:10 PM          0 try.txt


PS C:\>


Now copying the newly created file using the cp command on Cygwin:

user@hostname ~/try
$ cp /cygdrive/c/try.txt $PWD/


Now, the touch utility is used to create a file named 'touch.txt':

user@hostname ~/try
$ touch touch.txt

The ls command shows:

user@hostname ~/try
$ ls -l
total 0
-rw-r--r-- 1 user None 0 Dec 17 04:12 touch.txt
-rwxr-x--- 1 user None 0 Dec 17 04:12 try.txt


When the file is created with the touch utility, the permissions are
properly set for 'user', 'group', and 'other' but when the file is
copied from outsite of Cygwin only the 'user' and 'group' permissions
are set.
Obviously, 'other' is not used on Cygwin, everytime the file is SCPed on
a linux server the permissions need to be change for 'other' to match
the permissions on that server.
Why is that so and is there a better way around this?


--
John Doe

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Permissions not set for 'other' when copying from Windows

Corinna Vinschen-2
On Dec 17 13:06, john doe wrote:
> Hi,
>
> I'm trying to understand why a copied file from 'C:\' into
> /home/user/try doesn't have the permissions set for 'other' (see below).

POSIX "other" == Windows "Everyone".  Windows default permissions
typically don't give permissions to "Everyone".  Thus POSIX "other"
has no permissions by default after copying such a file.


Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Permissions not set for 'other' when copying from Windows

john doe
On 12/17/2018 1:15 PM, Corinna Vinschen wrote:

> On Dec 17 13:06, john doe wrote:
>> Hi,
>>
>> I'm trying to understand why a copied file from 'C:\' into
>> /home/user/try doesn't have the permissions set for 'other' (see below).
>
> POSIX "other" == Windows "Everyone".  Windows default permissions
> typically don't give permissions to "Everyone".  Thus POSIX "other"
> has no permissions by default after copying such a file.
>

Thank you, it works:

PS C:\> & icacls try.txt /grant "*S-1-1-0:(GA)"


The powershell way (set-acl) might be easier if you don't want to fiddle
with quoting and the call operator or simply use the command in cmd.exe
(no '&' and no quotes).

--
John Doe

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Permissions not set for 'other' when copying from Windows

Corinna Vinschen-2
On Dec 17 16:21, john doe wrote:

> On 12/17/2018 1:15 PM, Corinna Vinschen wrote:
> > On Dec 17 13:06, john doe wrote:
> >> Hi,
> >>
> >> I'm trying to understand why a copied file from 'C:\' into
> >> /home/user/try doesn't have the permissions set for 'other' (see below).
> >
> > POSIX "other" == Windows "Everyone".  Windows default permissions
> > typically don't give permissions to "Everyone".  Thus POSIX "other"
> > has no permissions by default after copying such a file.
> >
>
> Thank you, it works:
>
> PS C:\> & icacls try.txt /grant "*S-1-1-0:(GA)"
Just FTR: You can do this in Cygwin the POSIX way:

  chmod o+r try.txt

combined with -R for recursive tasks and with find(1) loops for more
complex scenarios.


Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment