Change permissions of files to -xw +r for all other users
Hey there,
I know this may be a case of RTM, but I am getting confused on it.
I want to change the permissions of all the files in my home folder to read only for all users but myself, but to leave directories executable so that they can be opened. I have had difficulty doing this for only other users, and have ended up -xw for myself as well, even tyring many variations of the -o tag. Any help would be fantastic.
Signature · 19 lines
Rhys Hardwick ----------------------------------------------------- | [email protected] | www.rhyshardwick.co.uk | | PGP-id - 0x63AB126D | | |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=| | Windows: Just another pain in the glass. | ***************************************************** ___________________________________________________________ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 9 lines · Rhys Hardwick
Hey there,
I know this may be a case of RTM, but I am getting confused on it.
I want to change the permissions of all the files in my home folder to read only for all users but myself, but to leave directories executable so that they can be opened. I have had difficulty doing this for only other users, and have ended up -xw for myself as well, even tyring many variations of the -o tag. Any help would be fantastic.
What program are you talking about ? The program find perhaps ? Or using just chmod ?
If you want to find any file in the current directory not owned by you then:
~: find . -type f ! -user imyselfandi -maxdepth 1
The `!' exclamation mark means NOT .
If you want to change the permission of all files which were found by the previous command you could tell find to exec chmod with the desired permissions, for example:
~: find . -type f ! -user imyselfandi -maxdepth 1 -exec chmod 0744 '{}' \;
Or you could use a command line shell filter:
~: find . -type f ! -user imyselfandi -maxdepth 1 | while read FILE ; do chmod 0744 ${FILE} ; done
Note; the command is actualy one line, the format breaks because of the text width in the e-mail message..
Hope this answers your question ...
Quoted 2 lines
Signature · 1 line
Rhys Hardwick
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
I was just using chmod. This helps. I can use find to only select files, not directories, and change the permissions. However, the real question is how to make chmod not alter the permissions for the files owner, but to remove write and exectute permissions for group and others. That is the bit that has stumped me.
Cheers,
Rhys
Quoted 45 lines · J.
Quoted 9 lines · Rhys Hardwick
Hey there,
I know this may be a case of RTM, but I am getting confused on it.
I want to change the permissions of all the files in my home folder to read only for all users but myself, but to leave directories executable so that they can be opened. I have had difficulty doing this for only other users, and have ended up -xw for myself as well, even tyring many variations of the -o tag. Any help would be fantastic.
What program are you talking about ? The program
findperhaps ? Or using justchmod?If you want to find any file in the current directory not owned by you then:
~: find . -type f ! -user imyselfandi -maxdepth 1
The `!' exclamation mark means NOT .
If you want to change the permission of all files which were found by the previous command you could tell find to exec chmod with the desired permissions, for example:
~: find . -type f ! -user imyselfandi -maxdepth 1 -exec chmod 0744 '{}' \;
Or you could use a command line shell filter:
~: find . -type f ! -user imyselfandi -maxdepth 1 | while read FILE ; do chmod 0744 ${FILE} ; done
Note; the command is actualy one line, the format breaks because of the text width in the e-mail message..
Hope this answers your question ...
Quoted 2 lines
--
Rhys Hardwick-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Signature · 20 lines
Rhys Hardwick ----------------------------------------------------- | [email protected] | www.rhyshardwick.co.uk | | PGP-id - 0x63AB126D | | |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=| | Windows: Just another pain in the glass. | ***************************************************** ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 5 lines · Rhys Hardwick
I was just using chmod. This helps. I can use find to only select files, not directories, and change the permissions. However, the real question is how to make chmod not alter the permissions for the files owner, but to remove write and exectute permissions for group and others. That is the bit that has stumped me.
Use a 0' a.k.a. zero with chmod` in the last position
If I would use the command ls -l on an arbitrary file in my directory:
-rw-rw-r-- 1 jason donovan 201 Apr 23 04:14 todo.txt
Now you can see that the user jason' has [r]ead[w]rite permissions the same goes for the group named donovan' and all other users have only [r]ead permissions .
chmod 0660 todo.txt
-rw-rw---- 1 jason donovan 201 Apr 23 04:14 todo.txt
Now the permissions for jason and donovan stayed the same; except for all other users [the world] which have no permissions.
Hope that helped...
J.
Quoted 3 lines
Cheers,
Rhys
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 4 lines
Hope that helped...
J.
Gotcha, thanks for the help. I did figure out that bit, it was the part about only selecting files, so when I -x 'd them, I wouldn't take list privileges away from the directories.
Thanks,
Rhys
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 7 lines · Rhys Hardwick
I was just using chmod. This helps. I can use find to only select files, not directories, and change the permissions. However, the real question is how to make chmod not alter the permissions for the files owner, but to remove write and exectute permissions for group and others.
That is the bit that has stumped me.
Ok, I was just reading your message again.. and I got it this time, You are mixing up symbolic mode with the octal mode.. oeff.. Sorry.. I'ts late here already.. ;-)
the command:
~: chmod o-rwx todo.txt
Will remove rwx from the third field e.g. others or the world' . The -' hyphen does not signal an option but stands for remove, instead of the hyphen -' you could als use the plus +' sign to add rights. The first character in this case is the `o' of others.. you could also use the u etc.. that's explained in the manual page..
~: chmod u-rwx todo.txt
J.
Quoted 43 lines
Cheers,
Rhys
Quoted 37 lines · J.
Quoted 9 lines · Rhys Hardwick
Hey there,
I know this may be a case of RTM, but I am getting confused on it.
I want to change the permissions of all the files in my home folder to read only for all users but myself, but to leave directories executable so that they can be opened. I have had difficulty doing this for only other users, and have ended up -xw for myself as well, even tyring many variations of the -o tag. Any help would be fantastic.
What program are you talking about ? The program
findperhaps ? Or using justchmod?If you want to find any file in the current directory not owned by you then:
~: find . -type f ! -user imyselfandi -maxdepth 1
The `!' exclamation mark means NOT .
If you want to change the permission of all files which were found by the previous command you could tell find to exec chmod with the desired permissions, for example:
~: find . -type f ! -user imyselfandi -maxdepth 1 -exec chmod 0744 '{}' \;
Or you could use a command line shell filter:
~: find . -type f ! -user imyselfandi -maxdepth 1 | while read FILE ; do chmod 0744 ${FILE} ; done
Note; the command is actualy one line, the format breaks because of the text width in the e-mail message..
Hope this answers your question ...
Quoted 30 lines
Quoted 8 lines
Quoted 2 lines
--
Rhys Hardwick-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqsSignature · 19 lines
Rhys Hardwick ----------------------------------------------------- | [email protected] | www.rhyshardwick.co.uk | | PGP-id - 0x63AB126D | | |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=| | Windows: Just another pain in the glass. | ***************************************************** ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs
Thursday, May 26 22:56:06
Signature · 7 lines
Don't worry Ma'am. We're university students, - we know what we're doing. - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 8 lines · Rhys Hardwick
Hey there,
I know this may be a case of RTM, but I am getting confused on it.
I want to change the permissions of all the files in my home folder to read only for all users but myself, but to leave directories executable so that they can be opened. I have had difficulty doing this for only other users, and have ended up -xw for myself as well, even tyring many variations of the -o tag. Any help would be fantastic.
What it sounds like you want to do is set permissions to read-only for others and group.
The proper command would be:
find ~ -type f -print0 | xargs -0 chmod og=r
The '0' causes each filename to be terminated with a null ('\0') rather than a newline (which is actually legal in a filename)
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
oops Re: Change permissions of files to -xw +r for all other users
Quoted 10 lines · Stephen Samuel
Quoted 5 lines · Rhys Hardwick
Hey there,
I know this may be a case of RTM, but I am getting confused on it.
I want to change the permissions of all the files in my home folder to read only for all users but myself, but to leave directories executable so that they can be opened. I have had difficulty doing this for only other users, and have ended up -xw for myself as well, even tyring many variations of the -o tag. Any help would be fantastic.
find ~ -type f -print0 | xargs -0 chmod og=r
On second thought:
Presuming that you really just want to remove write access, I'd try 'chmod og-w' or 'chmod og-wx'
That would remove the write bit or the write and execute bits, but not add the read bit. There tend to be some files in a users directory that you don't want readable all (like ssh private keys, cert files etc.)
Signature · 9 lines
Stephen Samuel +1(604)876-0426 [email protected] http://www.bcgreen.com/~samuel/ Powerful committed communication. Transformation touching the jewel within each person and bringing it to light. - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs