I was working in a directory and I accidently put chmod -R 000 .*
A lot of my root files and subfolders were chmod 0000!
Anyone know how I could get the regular permissions back, or am I going to have to reload the entire server?
I was working in a directory and I accidently put chmod -R 000 .*
A lot of my root files and subfolders were chmod 0000!
Anyone know how I could get the regular permissions back, or am I going to have to reload the entire server?
where were you in / ?
what directory
-Albert
I was in a folder that i created called /downloadsOriginally Posted by asmithjr
But the -R .* is what I think screwed me. after it did the files in the directory it moved up a directory level and started to do my /
I see the .* did it.
what does ls -l / give you
I can give you what I have for the directories but by no means for the entire drive,
If you look into /home for instance and see everything 000 bad news.
Last edited by asmithjr; 01-29-2005 at 04:54 PM.
-Albert
The /home directory seems to be ok....but most other directories are 000. I've gone through and tried to match as many of them as I can to another server, but not with much luck....Originally Posted by asmithjr
Some of the hard ones are like the /dev folder.....well all of the files in that folder.
I think the main problem isn't the folders themselves, but all of the files inside those folders iwth the different permissions.....
I think we are screwed....
I believe you can use the rdist command to copy files and perms over, that is if you can do r type commands from machine to machine.
either rdist or rsync might do the trick.
Other than that you need a listing of the perms before.
I'll keep thinking. but the rsync looks promising
take a look at the rcync man page.
Code:You use rsync in the same way you use rcp. You must specify a source and a destination, one of which may be remote. Perhaps the best way to explain the syntax is some examples: rsync *.c foo:src/ this would transfer all files matching the pattern *.c from the current directory to the directory src on the machine foo. If any of the files already exist on the remote system then the rsync remote-update proto- col is used to update the file by sending only the differences. See the tech report for details. rsync -avz foo:src/bar /data/tmp this would recursively transfer all files from the directory src/bar on the machine foo into the /data/tmp/bar directory on the local machine. The files are transferred in "archive" mode, which ensures that sym- bolic links, devices, attributes, permissions, ownerships etc are pre- served in the transfer. Additionally, compression will be used to reduce the size of data portions of the transfer. rsync -avz foo:src/bar/ /data/tmp a trailing slash on the source changes this behavior to transfer all files from the directory src/bar on the machine foo into the /data/tmp/. A trailing / on a source name means "copy the contents of this directory". Without a trailing slash it means "copy the direc- tory". This difference becomes particularly important when using the --delete option. You can also use rsync in local-only mode, where both the source and destination don´t have a ´:´ in the name. In this case it behaves like an improved copy command. rsync somehost.mydomain.com:: this would list all the anonymous rsync modules available on the host somehost.mydomain.com. (See the following section for more details.)
-Albert
Can you help me out on the syntax of that a bit?Originally Posted by asmithjr
I do have rsync, but can't figure out the exact syntax.
So if I am on the machine that has the bad files:
rsync -avz goodserverhostname:dev/ badhostname:dev/
would that be right?
I believe it would be,
From your good server:
# rsync -avz /dev/ badserver:/dev/
not sure if you need the goodserver but pretty sure you need the / infront of dev
-Albert
I think i got it:Originally Posted by asmithjr
From the good server:
# rsync -avz -e ssh /dev/ root@badserver:/dev/
yep that should do it
-Albert
rpm --setperms -a orOriginally Posted by noimad1
rpm --setugids -a
sets all the files/folders ownership, permission and modes to their default. Now, for your home directory and any other manually installed stuff, you have to do separately.
Jemshad O K
Bobcares
http://bobcares.com
http://poornam.com
I really don't think you want to rsync /dev from another box.. That might cause you a problem.
As posted by The man who caresrpm --setperms -a or
rpm --setugids -ais a good idea.
You could always try to run /dev/MAKEDEV $options (to rebuild /dev)
# man MAKEDEV (for more info)
Last edited by DigitalN; 01-30-2005 at 04:20 AM.
Thanks guys...yea I had already done some of the rsyncs and that did cause some problems....like I overwrote my mysql database file that holds all of the mysql users and passwords....that is another mess I'm having to clean up.Originally Posted by Jemshi
I found out the only directory I had left that was causing me problems was the actual ./ directory....took me a long time to find that one....
Thanks again for the help!
I decided to go ahead and run those commands anyways, but I received these errors:Originally Posted by Jemshi
rpmdb: /var/lib/rpm/Packages: unsupported hash version: 8
error: cannot open Packages index using db3 - Invalid argument (22)
?
Can someone tell me why .* caused it to go up to a higher directory? Does that .* signify root directory? If I try ls . I get a listing for current directory, but if I try ls .* I get a listing for root directory.Originally Posted by noimad1