LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 03-21-2014, 03:07 PM   #1
nativetongue03
LQ Newbie
 
Registered: Mar 2014
Posts: 4

Rep: Reputation: Disabled
Restoring directory and subdirectory permissions/ownership


Newbie here, again.

I made a mistake the day and set a directory ownership to chown -R user1:Other on directory Level1 thus making it
Code:
drwxr-xr-x   3 user1     other         512 Jul 11  2013 Level1
The original ownership was set to root:root
Code:
drwxr-xr-x   3 root     root         512 Jul 11  2013 Level1
but within that directory, about 3 directory levels down, there are multiple subdirs of files with various owners as seen below and I need to restore them.

Just to give you an example of what it SHOULD look like the information below is that from the second node of the cluster which still has it's correct permissions and ownerships set

ORIGINAL
Code:
NODE1:root@/var/Level1/Qmail/postfix$ ls -ltrh
total 28
drwx------   2 postfix  root         512 Jul 11  2013 corrupt
drwx------   2 postfix  root         512 Jul 11  2013 flush
drwx------   2 postfix  root         512 Jul 11  2013 hold
drwx-wx---   2 postfix  postfix      512 Jul 11  2013 maildrop
drwx------   2 postfix  root         512 Jul 11  2013 saved
drwx------   2 postfix  root         512 Jul 11  2013 trace
drwxr-xr-x   2 root     root         512 Jul 31  2013 pid
drwx------  18 postfix  root         512 Aug 23  2013 defer
drwx------  18 postfix  root         512 Aug 23  2013 deferred
drwx--x---   2 postfix  postfix      512 Mar 13 08:21 public
drwx------   2 postfix  root         512 Mar 13 08:21 private
drwx------   2 postfix  root         512 Mar 21 12:00 incoming
drwx------   2 postfix  root         512 Mar 21 12:00 bounce
drwx------   2 postfix  root         512 Mar 21 12:00 active
i want to know if there is any way to somehow export the directory and subdirectory ownerships/permissions from one node to duplicate it onto the other.

I've looked into using getfcal and setfcal but it doesnt seem to worth with multiple subdirectories.

Any assistance is appreciated.. Just trying to keep from having to set them all manually.

Last edited by nativetongue03; 03-21-2014 at 03:09 PM.
 
Old 03-22-2014, 08:51 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,492
Blog Entries: 54

Rep: Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908
Quote:
Originally Posted by nativetongue03 View Post
I made a mistake
Well as long as you learn from it...


Quote:
Originally Posted by nativetongue03 View Post
export the directory and subdirectory ownerships/permissions from one node to duplicate it onto the other.
You might have to strip off a whole lot of options (always test with "--dry-run") but I think 'rsync' might do the trick. Else you could use 'find', print the required attributes and use that as a shell script on the victim side. This is GNU find:
Code:
find /var/spool \( -fprintf /tmp/ownership.txt 'chown %u.%g %p; chmod %m %p\n' \)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restoring file and directory permissions on Centos 6.5, 64 bit using Live CD jyunker Linux - Newbie 15 01-21-2014 07:57 AM
Permissions Issue: directory+ subdirectory r/w etc access for current user? ChiggyDada Linux - Newbie 1 01-28-2013 06:48 AM
Directory ownership or permissions inside another directory Slyfox696 Linux - Newbie 3 11-02-2012 02:14 PM
Automatically change permissions/ownership of files in a directory Shimdidly Linux - Newbie 3 04-08-2012 08:22 PM
Restoring Home Directory Ownership taylortbb Linux - General 1 08-27-2004 09:40 AM


All times are GMT -5. The time now is 10:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration