LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 09-08-2007, 11:54 AM   #1
joangopan
LQ Newbie
 
Registered: Aug 2007
Location: Mexico DF
Distribution: Debian and Fedora
Posts: 21

Rep: Reputation: 15
FC4 Restore Directory permisions


Hi all...

I have a problem, my run chown -R named:named /var/named and all files change to named:named

i have Fedora Core 4, exist some how restore original permisions to the machine?

Thanks! in Advance.
 
Old 09-08-2007, 05:11 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,987
Blog Entries: 54

Rep: Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742
Save as "rpm-restore", make it executable and give it the name of the package (ex: named, not "named-1.2.3." or "named-1.2.3.rpm") and save the output to a file. Verify the contents of the output file, remove any lines for files that don't need permissions changed then execute the file as a shellscript.
Code:
#!/bin/sh
# Purpose: Restore filesystem permissions from RPM database.
# Args: package name
# Deps: Bash, GNU utils, rpm
# Run from: commandline.
case "$#" in 1) pkg="$1";; *) exit 127;; esac
rpm -q --dump ${pkg}|while read t; do
 t=( ${t} ); for i in 3 4; do case "${#t[$i]}" in 7)
 echo "chmod ${t[$i]:3:4} ${t[0]}"
 echo "chown ${t[5]}.${t[6]} ${t[0]}";;
esac; done; done; exit 0
N.B.: If anyone knows a GNU/Linux package manager besides RPM you can query for details like this and that can do package content verification, roll back and restore out of the box let me know. I doubt it though ;-p

N.B.: while a problem, this is not Linux Security related. I'll be moving this thread to the Fedora forum.
 
  


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
How to restore /usr/lib/perl5/site_perl/5.8.6 directory on FC4 vadiml Linux - Server 3 04-28-2007 07:50 PM
unable to restore desktop resolution on FC4 gopi.d Fedora 14 03-06-2006 12:06 PM
Restore directory permissions help! taigon Linux - General 2 03-05-2006 01:12 PM
ProFTPd - files and directory permisions flyinprogrogramer Linux - Software 2 02-16-2006 08:06 PM
howto chowto change file permisions in multiplhange file permisions in multiple dirs? pingvina Linux - Software 3 01-13-2006 03:10 PM


All times are GMT -5. The time now is 05:15 PM.

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