LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-10-2010, 09:57 AM   #1
stevanbt
LQ Newbie
 
Registered: Dec 2004
Location: uk
Distribution: Ubuntu
Posts: 20

Rep: Reputation: 0
Help - chmod -R in /var


Hi,
I've just, stupidly, ran chmod -R apache in /var. I immediately lost ssh due to permissions, but have recovered that.

I have a full system tar backup, if possible I'd like to avoid restoring the files. Is it possible to use the permissions in the backup to restore just the permissions in /var?

Thanks, Steve.
 
Old 11-10-2010, 10:14 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,911

Rep: Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702Reputation: 4702
Quote:
Originally Posted by stevanbt View Post
Hi,
I've just, stupidly, ran chmod -R apache in /var. I immediately lost ssh due to permissions, but have recovered that.

I have a full system tar backup, if possible I'd like to avoid restoring the files. Is it possible to use the permissions in the backup to restore just the permissions in /var?

Thanks, Steve.
Yes, it's possible, but may be tricky. Personally, I'd boot the system off a live CD/rescue distro, restore the /var from the .tar backup to a separate directory, and write a script to read the permissions from those files, and apply them to the 'real' /var directory/files. You could also just restore that one directory tree from the tape to /var, which will also do it, and be much quicker...but you may overwrite some existing data if you do it that way.

Also, from looking at my systems, it seems like MOST things under /var are owned by root:root, so you could just shotgun it and do a "chmod -R root:root /var/*", then change some things manually. Apache2 is obvious, /var/cache/man needs to be man:man, /var/cache/hald needs to be haldaemon:haldaemon, /var/cache/icecream is icecream:icecream squid is squid:root. That should get you up and going, and you can deal with individual permissions issues easily after that.
 
Old 11-12-2010, 01:44 AM   #3
stevanbt
LQ Newbie
 
Registered: Dec 2004
Location: uk
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks TB0ne, I will attempt to restore and copy the permissions from restored files.

Thanks, Steve.
 
  


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
Mis applied chmod command in /var pentalive Linux - General 2 08-18-2008 02:09 PM
is it safe to set /var to chmod 777 carlosruiz Linux - Security 5 06-17-2004 05:57 AM
is it safe to set /var to chmod 777 carlosruiz Linux - Security 4 12-31-2003 04:00 AM
chmod of /var/www/html alTereD Linux - Security 1 12-16-2002 02:43 PM
Giving a user CHMOD rights to the /var/www/html directory? scubes13 Linux - Networking 3 08-18-2002 03:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:49 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration