- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: change file mode
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
09-28-2005 03:49 PM
09-28-2005 03:49 PM
change file mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2005 03:53 PM
09-28-2005 03:53 PM
Re: change file mode
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2005 04:01 PM
09-28-2005 04:01 PM
Re: change file mode
find /dir -type d -user edp_user -exec chmod "perms" {} \;
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2005 04:11 PM
09-28-2005 04:11 PM
Re: change file mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2005 06:26 PM
09-28-2005 06:26 PM
Re: change file mode
a) All the files in the path you select will be changed, including any subdirectory that may be part of the given path. You may have to redo subdirectories to reflect the correct permissions for them.
b) Only root and the owner of the file can change the mode. Make sure your UID is the owner of the files. Alternatively you can login as root.
c) You may want to use the script below after you test it to help you with the task (no guaranties of any kind). Best of luck
SCRIPT ----------------------
#! /usr/bin/sh
ARGS=$#
ARG0=$0
ARG1=$1
ARG2=$2
ARG3=$3
usg_msg()
{
echo "\n$1 \n
usage: $ARG0 arg1 arg2 arg3
arg1 = directory_namename (relative or absolute)
arg2 = new mode for the files in the directory
arg3 = new mode for subdirectories
(all arguments must must be entered)
"
}
tst_arg()
{
if [ $ARGS -ne 3 ]
then
echo $#
usg_msg "Invalid number of arguments"
exit 1
fi
if [ -d $ARG1 ]
then
DIRPATH=$ARG1
else
usg_msg "Invalid directory path"
exit 1
fi
if (echo $ARG2 | grep "[a-zA-Z]" > /dev/null)
then
usg_msg "$ARG2 Invalid mode"
exit 1
else
FILEPERM=$ARG2 #set this variable to the mode for ordinary files
fi
if (echo $ARG3 | grep "[a-zA-Z]" > /dev/null)
then
usg_msg "$ARG3 Invalid mode"
exit 1
else
DIRPERMS=$ARG3 #set this to the mode required for subdirectories
fi
}
tst_arg
echo $DIRPATH $FILEPERM $DIRPERMS
read nothing
for afile in $(find $DIRPATH)
do
if test -d $afile
then
chmod $DIRPERMS $afile
else
chmod $FILEPERM $afile
fi
done