- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Retrive the 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
07-07-2010 06:06 PM
07-07-2010 06:06 PM
Is there any way to retive the old permissions of all the Files under /oracle_pub.
[xxtredg51:/]#chmod -R 755 /oracle_pub
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 06:12 PM
07-07-2010 06:12 PM
Re: Retrive the permissions
are you asking or telling the answer.
well there is no way to recover the permission.
You can on the other hand fix the permission of root file system (almost all) with swverify.
There is nothing you can do to oracle_pub, other than restore or if you know the permission earlier.
BR,
Kapil+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 06:15 PM
07-07-2010 06:15 PM
Re: Retrive the permissions
looking for some answers....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 06:54 PM
07-07-2010 06:54 PM
Re: Retrive the permissions
If not, you could try restoring from your backup to a different directory, or different server, and then look at the files that were restored to see their ownership and permissions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 07:21 PM
07-07-2010 07:21 PM
Re: Retrive the permissions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 08:34 PM
07-07-2010 08:34 PM
Re: Retrive the permissions
there is no magic for the issue you have.
Second
the only way to have permission backup is run
ls -lRt /oracle_pub > your_backup
Third,
I hope I have not provided the answer again
so 0 point again :)
BR,
Kapil+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 08:53 PM
07-07-2010 08:53 PM
Solutionexecute this comand before the permission change
find /oracle_pub -exec ls -ld {} \; |awk '{print $1,$3,$4,$9}' >> /tmp/file_dir_permission
the above command will create a file named "file_dir_permission" on /tmp and the contents will look like below
-rw-r--r-- root sys /tmp/unzip-6.0-ia64-11.31.depot
drwxr-xr-x root sys /tmp/mars_backup
-rw------- hpsmdb users /tmp/.s.PGSQL.50006.lock
srwxrwxrwx hpsmdb users /tmp/.s.PGSQL.50006
-rw-r--r-- root sys /tmp/iSCSI-00_B.11.31.03_HP-UX_B.11.31_IA_PA.depot
Regards!
Johnson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 09:23 PM
07-07-2010 09:23 PM
Re: Retrive the permissions
-If you have previous output of the /oracle_pub directory ( like # find . -type f -exec ls -l {} \; > oracle_pub_orig_files.list ) , you can check and reset the permissions to it's original values.
- Also if you have backup (netbackup or Dataprotector backing up the data) you can restore it on a different directory and retrive the old permissions.
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 09:50 PM
07-07-2010 09:50 PM
Re: Retrive the permissions
You could use my scripts in this thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1215123
One will save the info and the other will restore them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 10:08 PM
07-07-2010 10:08 PM
Re: Retrive the permissions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 10:13 PM
07-07-2010 10:13 PM
Re: Retrive the permissions
Is it possible take permissions back-up of all the files under the directory in octal format before running the chmod in recursive mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 10:47 PM
07-07-2010 10:47 PM
Re: Retrive the permissions
Have you looked at my scripts? They don't use the obsolescent octal format but use a symbolic format, which is the preferred format for chmod(1).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 11:35 PM
07-07-2010 11:35 PM
Re: Retrive the permissions
> Is it possible take permissions back-up of all the files under the directory in octal format before running the chmod in recursive mode.
- permission backup you can take with just:
#DATE="`date +%H%M.%m%d%y`" ; DIR="/oracle_pub"
# find $DIR -xdev -exec ls -l {} \; > all_file_dir_details.$DATE.txt
- The .txt file can be followed anytime you have problem finding any file/directory permission or ownership problem. And you can set it with chown and chmod command.
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2010 11:53 PM
07-07-2010 11:53 PM
Re: Retrive the permissions
Yes but you really want a script to handle the zillions of bad files.
>find ... -exec ls -l {} \;
By using "+" instead of "\;" you can make it much faster. And you need to add "-d" so you don't list files twice:
-exec ls -l -d {} +
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2010 01:04 AM
07-08-2010 01:04 AM
Re: Retrive the permissions
And ofcourse a script can only help to fix zillions of files..,
Regards,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2010 01:26 AM
07-08-2010 01:26 AM
Re: Retrive the permissions
Check out the script attached to save current permisions in both numeric and -rwx format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2010 01:37 AM
07-08-2010 01:37 AM
Re: Retrive the permissions
Check out the script (getperms) attached here ,to display/save current permisions in both octal and -rwx format.
(pls ignore the earlier post, missed the file):
output:
# ./getperms /etc
OK
755 drwxr-xr-x /etc
755 drwxr-xr-x /etc/initramfs-tools
644 -rw-r--r-- /etc/initramfs-tools/modules
755 drwxr-xr-x /etc/initramfs-tools/conf.d
644 -rw-r--r-- /etc/initramfs-tools/conf.d/resume
644 -rw-r--r-- /etc/initramfs-tools/update-initramfs.conf
644 -rw-r--r-- /etc/initramfs-tools/initramfs.conf
755 drwxr-xr-x /etc/initramfs-tools/hooks
755 drwxr-xr-x /etc/initramfs-tools/scripts
755 drwxr-xr-x /etc/initramfs-tools/scripts/init-bottom
755 drwxr-xr-x /etc/initramfs-tools/scripts/local-top
---------------------------------------------
Hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2010 06:23 PM
07-09-2010 06:23 PM
Re: Retrive the permissions
I will check and update ASAP.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2010 09:20 PM
07-09-2010 09:20 PM
Re: Retrive the permissions
I ran the Script, but the all the permissions saved "000" format.Please look in to the attached file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2010 12:21 AM
07-10-2010 12:21 AM
Re: Retrive the permissions
The latest version attached here with, check it out, hope this will fix the problem: fine,
# Usage :
# ./getperms /path
or
# ./getperms .
---------------------------
Example:
########
$ ./getperms /var/tmp
OK
776 drwxrwxrwt root:root /var/tmp
555 dr-xr-xr-x root:root /var/tmp/bgpd
755 drwxr-xr-x root:sys /var/tmp/hsperfdata_root
555 dr-xr-xr-x root:root /var/tmp/isisd
555 dr-xr-xr-x bin:bin /var/tmp/ntp
555 dr-xr-xr-x root:root /var/tmp/ramd
555 dr-xr-xr-x root:root /var/tmp/ripngd
$
$ ls -l /var/tmp
total 0
dr-xr-xr-x 2 root root 96 Jun 12 12:45 bgpd
drwxr-xr-x 2 root sys 96 Jun 27 23:57 hsperfdata_root
dr-xr-xr-x 2 root root 96 Jun 12 12:45 isisd
dr-xr-xr-x 2 bin bin 96 Jun 12 12:13 ntp
dr-xr-xr-x 2 root root 96 Jun 12 12:45 ramd
dr-xr-xr-x 2 root root 96 Jun 12 12:45 ripngd
$
---------------------------------------------------------------------
Enjoy, Have fun!.,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2010 02:28 AM
07-10-2010 02:28 AM
Re: Retrive the permissions
Finally ...:
The backup restore part of the permission is here:
Usage: Change the value of P (The path), and you can use it for backup restore:
PERMISSION and OWNERSHIP Backup Restore:
____________________________________________________________________________________________________________________
P=/anypath/subpath ; P1=`echo $P | tr "/" "_"`
BACKUP :# ./getperms $P > perms.$P1.bkup
Restore Perm command generation:
mode: # awk '{print "chmod " $1,$4}' perms.$P1.bkup > chmod_restore.$P1.sh ; chmod +x chmod_restore.$P1.sh
ownership: # awk '{print "chown " $3,$4}' perms.$P1.bkup > chown_restore.$P1.sh ; chmod +x chown_restore.$P1.sh
RESTORE : # ./chmod_restore.$P1.sh ; ./chown_restore.$P1.sh
VERIFICATION :
# ./getperms $P > perms.$P1.restored
# sdiff -s perms.$P1.bkup perms.$P1.restored
Enjoy:
_______________________________________________________________________________________________________________________
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2010 04:54 AM
07-10-2010 04:54 AM
Re: Retrive the permissions
IS there some reason you want to destroy the usefulness of these directories and files? IF this is some misguided recommendation by an auditor, tel your manager to send the auditors a bill for recovery services. 755 cannot be a default permission for random files and directories. The manufacturer (Oracle) may have set the permissions during the install steps, and trying to blindly change everything can break a lot of code. 755 is the WRONG permission for data files! It might (accidentally) be correct for executable programs and scripts.
The correct permission and ownership must be set according to the requirements of your application. 755 for directories and 644 for files is a starting point, but NEVER 777 for anything except junk files and directories.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2010 05:42 PM
07-10-2010 05:42 PM
Re: Retrive the permissions
The above incident was happened due to requestor raised a new service request, to creare new directories and subdirectories under the /oracle_pub for the new application deployment.The request was something like
1.create new folder under /oracle_pub/test/latest/.....
2.Set the permission 755
3.change the owner ship
chmod -R oracle:oracle "new directories"
Instead of changing the permissions for the newly created directories, Unix SA ran the above (chmod -R /oracle_pub) command.So it changed all the permissions from the parent directory (/oracle_pub) recursively.