Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 20
  1. #1
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default Big Problem - I accidently chmod 000 a lot of files!

    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?

  2. #2
    Member
    Join Date
    Jun 2003
    Posts
    396

    Default

    where were you in / ?

    what directory
    -Albert

  3. #3
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    Quote Originally Posted by asmithjr
    where were you in / ?
    I was in a folder that i created called /downloads

    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 /

  4. #4
    Member
    Join Date
    Jun 2003
    Posts
    396

    Default

    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

  5. #5
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    Quote Originally Posted by asmithjr
    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.
    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....

    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....

  6. #6
    Member
    Join Date
    Jun 2003
    Posts
    396

    Default

    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

  7. #7
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    Quote Originally Posted by asmithjr
    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.)
    Can you help me out on the syntax of that a bit?

    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?

  8. #8
    Member
    Join Date
    Jun 2003
    Posts
    396

    Default

    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

  9. #9
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    Quote Originally Posted by asmithjr
    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
    I think i got it:

    From the good server:

    # rsync -avz -e ssh /dev/ root@badserver:/dev/

  10. #10
    Member
    Join Date
    Jun 2003
    Posts
    396

    Default

    yep that should do it
    -Albert

  11. #11
    Member Jemshi's Avatar
    Join Date
    Sep 2003
    Location
    India
    Posts
    217

    Default

    Quote Originally Posted by noimad1
    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?
    rpm --setperms -a or
    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

  12. #12
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    I really don't think you want to rsync /dev from another box.. That might cause you a problem.

    rpm --setperms -a or
    rpm --setugids -a
    As posted by The man who cares is 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.

  13. #13
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    Quote Originally Posted by Jemshi
    rpm --setperms -a or
    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
    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.

    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!

  14. #14
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    Quote Originally Posted by Jemshi
    rpm --setperms -a or
    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 decided to go ahead and run those commands anyways, but I received these errors:

    rpmdb: /var/lib/rpm/Packages: unsupported hash version: 8
    error: cannot open Packages index using db3 - Invalid argument (22)

    ?

  15. #15
    Member
    Join Date
    Feb 2004
    Location
    San Ramon, CA
    Posts
    35

    Default

    Quote Originally Posted by noimad1
    I was working in a directory and I accidently put chmod -R 000 .*
    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.

Similar Threads & Tags
Similar threads

  1. CHMOD 000 Hacked
    By gtshadow in forum Data Protection
    Replies: 7
    Last Post: 09-03-2009, 04:35 PM
  2. I Accidently Deleted a lot of DNS Zones from /var/named
    By Dr. Bogger in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 11-30-2008, 07:40 AM
  3. Urgent: Folders and Files Permission(chmod) Problem!
    By WebHour.net in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-04-2006, 08:05 AM
  4. *cc* - should I chmod it to 000?
    By hostito in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 05-21-2003, 09:27 PM
  5. Chmod 000 c compilers
    By iago in forum cPanel and WHM Discussions
    Replies: 11
    Last Post: 05-18-2003, 02:32 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube