- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Need help with a find command
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
Forums
Discussions
Discussions
Discussions
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
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
01-19-2011 10:08 PM
01-19-2011 10:08 PM
Looking for some help regarding a find command. I need to go through all the /home directoris and change all files used during the user login process, eg. .profile, .sh_history, etc that have permissions of 644 and change them to 600. Need the find command to skip directories, don't want to change the permissions on the .ssh directory for example.
Thank you in advance for your input
Norm
Solved! Go to Solution.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2011 10:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2011 12:58 AM
01-20-2011 12:58 AM
Re: Need help with a find command
find /home -type f -name ".*" -perm 644 -exec chmod 600 {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2011 01:19 AM
01-20-2011 01:19 AM
Re: Need help with a find command
Nothing wrong with the Posix standard: -exec ... {} +
Especially if you want performance.
Note: -name ".*" changes all dot files, not just "files used during the user login process". Even in subdirectories.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2011 06:10 AM
01-20-2011 06:10 AM
Re: Need help with a find command
To add to Dennis's comments, have a look at the 'find(1)' manpages under the '-exec' option. The differences between the ';' and the '+' terminator (including performance) are nicely discussed with examples there:
http://bizsupport.austin.hp.com/bc/docs/support/SupportManual/c02258880/c02258880.pdf
As usual, the manpages are your friend :-)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2011 07:40 AM
01-20-2011 07:40 AM
Re: Need help with a find command
You have identified the source of my problem, you can't use ".*" as this will indeed change the .. perms, not good.
So how can I get around this, is it possible with the find command?
Thank you for your input.
Norm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2011 07:46 AM
01-20-2011 07:46 AM
Re: Need help with a find command
>>problem, you can't use ".*" as this will
>>indeed change the .. perms, not good.
This should only happen if you do NOT specify the item type you are looking for.
If you use the example above where '-type f' is specified then you should only get regular files and not directories.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2011 07:48 AM
01-20-2011 07:48 AM
Re: Need help with a find command
> indeed change the .. perms, not good.
Really? Did you try it? And "-type f"
didn't help?
As usual, showing actual commands with their
actual output can be more helpful than vague
descriptions or interpretations (or
speculations).
man find
Look for "!". It should work with something
like
-name ..
too. If you really needed to do that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2011 09:57 AM
01-20-2011 09:57 AM
Re: Need help with a find command
Thank you for all your responses, as it turns out I was making it more difficult than it should be.
Thread closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2011 10:06 PM
01-21-2011 10:06 PM
Re: Need help with a find command
Right. You don't need -type f because find(1) automatically skips . and .. because it wouldn't make progress if it looked at them.
You do have to worry when using ls(1) though.