1
In my cygwin
terminal, I could not modify files in my home directory
$ echo $HOME
/home/user123
$ cd $HOME
$ pwd
/home/user123
$ ls -ld .
drwxr-xr-x+ 1 user123 None 0 Jan 2 16:46 .
$ touch foo
touch: cannot touch `foo': Permission denied
$ whoami
user123
However, if I Run as administrator
when I started the cygwin
terminal, I could modify the file
$ echo $HOME
/home/user123
$ cd $HOME
$ pwd
/home/user123
$ touch foo
$ ls -ld foo
-rw-r--r-- 1 user123 None 0 Jan 2 17:00 foo
$ whoami
user123
How can I fix this problem? Thanks!
Update
I checked the folder properties as recorded by Windows, it shows that the check box for "Read-Only" has been checked. (See a screenshot below.) I tried unchecking it but that did not help. Also I noticed two things:
- The check-box label says "Read-Only (Only applies to files in folder). Does that mean folders are not marked as "Read-Only" not matter what the status of the check box is? Apparently my current problem is that the home folder is marked as read-only (except for Administrator). How do I change that?
When I tried to change the "Read-Only" status (unchecked the box and the
Apply
), I got a lot of pop-up that saidAn error occurred apply attributes to the file Access is denied.
The relevant filepaths are all the files that start with a dot (.) (UNIX hidden files). In my operation, I chose to option of Ignore
for these pop-ups
Update 2
The following is the screenshot for the security tab. Note that I the Add
button is grayed out (even though I was doing this with Run as administrator
). Also, when I entered the tab, there is a pop-up with this message:
The permissions on user123 are incorrectly ordered,
which may cause some entries to be ineffective.
One more question: how do I know how the two users with long numerical IDs (S-1-5-21-...) are mapped to the symbolic usernames?
2Can you write to the folder outside of Cygwin? Check Windows permissions for your user on that folder. – simlev – 2018-01-02T22:40:11.663
@simlev -- I could write outside of that folder. As for Windows permissions, please see my updated question -- basically I saw that the folder has "Read-Only" (partially checked), but I don't know to to change the state for that. – leeyuiwah – 2018-01-03T15:27:11.410
1I was asking whether you can write (e.g. create files) inside that folder from outside of Cygwin. I would ignore the
Read-only
attribute. Permissions are found in theSecurity
tab, then click onAdvanced
. – simlev – 2018-01-03T16:28:54.593@simlev -- Indeed I could not write to the folder outside of
cygwin
(e.g. usingWindows Explorer
). Also, I added "Update 2" to my question. Please take a look. How do I change the settings for security? (TheAdd
button is grayed out) How do I map the users' symbolic name to their numerical IDs? Thanks a lot! – leeyuiwah – 2018-01-03T16:49:19.217Hi, I now know how to interpret those SIDs (S-1-5-21-...), thanks to this explanation: https://cygwin.com/cygwin-ug-net/ntsec.html But I still cannot change the settings (even when I
– leeyuiwah – 2018-01-03T18:44:56.980Run as administrator
). I also tried "elevating permission" (https://msdn.microsoft.com/en-us/library/dd298823.aspx) still could not get the UI to allow me to change the permission1Login to Windows as the administrator. If the permissions are not too messed up you should be able to give "Full control" to
user123
on its home folder. – simlev – 2018-01-03T22:12:30.840