- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Changing file permissions
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
08-14-2002 05:04 AM
08-14-2002 05:04 AM
If I have files with permissions of 777 and I want to change all to 644, is there a way to change them in one shot.
It seems easy, I just can't think how to do it.
Having a hard time grasping the different loops in shell scripting. Is there a good site to check out with examples. I have books but I need something new to look at.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:08 AM
08-14-2002 05:08 AM
Re: Changing file permissions
HTH,
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:09 AM
08-14-2002 05:09 AM
Re: Changing file permissions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:10 AM
08-14-2002 05:10 AM
Re: Changing file permissions
for i in `find / -exec ls -a {} \;`
do
chmod 644 $i
done
Note, a 'ls' won't do, because it does not contain a full path.
Regards,
Ceesjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:10 AM
08-14-2002 05:10 AM
Re: Changing file permissions
find . -type f -perm 777|xargs chmod 644
find . -type f -perm 777|while read line
do
chmod 644 $line
done
steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:11 AM
08-14-2002 05:11 AM
Re: Changing file permissions
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:11 AM
08-14-2002 05:11 AM
Re: Changing file permissions
Perhaps you should use -type to get only files (not directorys).
finf . -type f -perm 777 -exec chmod 777 {}\;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:11 AM
08-14-2002 05:11 AM
Re: Changing file permissions
You can do that a little better with find: 'find dir2change -type f -exec chmod 644 {} \;'.
Now if you want to put that in a loop:
for FILE in $(find dir2change -type f -print)
do
chmod 644 $FILE
done
Regards,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:13 AM
08-14-2002 05:13 AM
Re: Changing file permissions
Of cource not chmod 777, but chmod 644.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:14 AM
08-14-2002 05:14 AM
Re: Changing file permissions
Try using
find . -perm 777 -exec chmod 644 {} \;
OR
find . -perm 777 -print | xargs chmod 644
Either way will do it for you w/o having to use an explicit loop.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 05:14 AM
08-14-2002 05:14 AM
Re: Changing file permissions
Yes you can. For example change everything in /home/me
for i in `ls /home/me`
do
chmod 644 $i
done
For a web site if you are using the korn shell
try http://www.kornshell.com/
Cheers
Keely