LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-24-2011, 11:04 AM   #1
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Fixing a permission problem


Quickest way to restore permissions on files?

Someone changed every file on the system to 0000. I have a backup, yes. But I don't want to copy every single file back over.

Is there a way to just restore the permissions from the backup?

Thanks.
 
Old 06-24-2011, 12:57 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi there,

If you have taken the backup of file system permissions before, then you can try the following: http://www.concrete5.org/documentati...ions-in-linux/

Else I am not aware of any other way.
 
Old 06-24-2011, 03:26 PM   #3
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Hi,

here is some bash code that should also work. Assuming that your backup-partition is mounted on /mnt
Code:
while read FILE; do
  echo chmod "$(stat -c %a ${FILE})" "${FILE/\/mnt}"
done < <(find /mnt -wholename /mnt/mnt -prune -o -type f -print 2>/dev/null)
Remove the 'echo' if the output looks alright.
 
  


Reply



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
LXer: Tutorial: Fixing sudo Permission Denied Errors LXer Syndicated Linux News 0 07-08-2010 04:00 AM
Continuing w/o Fixing PTY Problem check8 Linux From Scratch 5 02-09-2007 07:24 PM
Need help fixing permissions problem. M$ISBS Linux - Security 4 12-25-2006 02:17 PM
Need help fixing grub related problem joint Linux - Software 4 12-08-2006 09:20 AM
Need help fixing java compiling problem emu_123 Programming 5 12-23-2003 05:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration