- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: how to get rid of unnecessary permission
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-04-2009 10:22 AM
тАО07-04-2009 10:22 AM
I made joe the owner of /data, then I allowed joe for rwx and no access to other users
# chmod -R 700 /data
no issue yet, but the above command set the execute permission on every file(text, jpg, png, pdf etc) under /data/sub-directories
and I dont like unnecessary execute permissions on files.
so in short how can I run "chmod -R 700 /data" without the 'x'(unnecessary) permission on text/jpg/png/pdf files
any suggestion/tip/recommendation would be highly appreciated
Regards
Maaz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-04-2009 11:29 AM
тАО07-04-2009 11:29 AM
SolutionAt this point, you will have to construct a command that sets "chmod 600" for files only (not directories). For this, you'll need the "find" command.
You did not identify your Linux distribution, so I'll have to give you a preferred generic form of the command. It's a bit long, but should work in even very old versions of Linux:
find /data -type f -print0 | xargs -0 chmod 600
A shorter form (may or may not work, depending on which version of the "find" command is installed in your Linux distribution):
find /data -type f -exec chmod 600 {} \+
An inefficient form that works, but should be avoided when dealing with large numbers of files:
find /data -type f -exec chmod 600 {} \;
(yes, that single character makes a lot of difference!)
A tip for the future: using octal numeric permissions with the -R option of chmod is likely to give you a headache. When doing recursive changes, you should state what you mean in another way. Instead of your original command, you might have wanted to do this:
chmod -R u=rwX,go-rwx /data
meaning:
- for the _u_ser that owns the files, give r and w access; also give x permission IF the target is a directory OR already has some x permissions set
- remove all other permissions
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-04-2009 08:23 PM
тАО07-04-2009 08:23 PM
Re: how to get rid of unnecessary permission
You shouldn't use "chmod -R", it will only get you into trouble, unless you have something simple like "chmod -R a+r"
To remove permissions, you could use find with particular suffixes:
find /data \( -name "*.pdf" -o -name "*.txt" \) -exec chmod a-x \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-05-2009 09:03 PM
тАО07-05-2009 09:03 PM
Re: how to get rid of unnecessary permission
thanks for the excellent help
>You did not identify your Linux distribution
its SLES10 SP2, and RHEL 4.6
>find /data -type f -exec chmod 600 {} \+
from a "find tutorial"
The semicolon closes the -exec instruction. Because this is a special character, it is
masked by placing a backslash in front of it.
but what "\+" does ?
Hi Dennis Handly, thanks for the help, and suggestions.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-05-2009 09:37 PM
тАО07-05-2009 09:37 PM
Re: how to get rid of unnecessary permission
(You don't need that "\" before the "+".)
If you have a real OS that is Unix branded, the "+" char allows multiple files to be passed to the program under -exec. For HP-UX:
http://docs.hp.com/en/B2355-60130/find.1.html#d0e85142
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-06-2009 03:06 AM
тАО07-06-2009 03:06 AM
Re: how to get rid of unnecessary permission
This is a link to a Bill Hassell hpux system configuration document.
http://www.hpux.ws/?p=12
Before you walk away from it, it has a great script for identifying files with questionable permissions that will work on Linux.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com