Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, I think I accidentally chmodded some very important files of mine to have no one have permissions to do anything. When I do an "ls -la" I don't see ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2004
    Posts
    5

    CHMOD Help!!


    Hi,

    I think I accidentally chmodded some very important files of mine to have no one have permissions to do anything. When I do an "ls -la" I don't see anything. I even tried logging into root to see if it could access those files, but it didn't work either.

    I was playing around with the chmod -R switch because I was thinking it was recursive.

    I think the command I might have put in to make no one have permissions to do anything is "chmod -R go-rw"

    Is there any way I can set them back so that at least the root can access them?

    Thanks A LOT,
    Ryan

  2. #2
    Just Joined!
    Join Date
    Nov 2004
    Posts
    17
    Sure. Root has access to everything, so just su to root and chmod them back to their original permissions.

    chmod primer:

    Read: 4
    Write: 2
    Execute: 1

    First number is owner, second is group, last is world. So, chmod 777 is full access for everybody. 644 mean owner can read and write and everyone else can just read, etc.

    If they are your files make sure that the owner reflects that, i.e., use the chown command (as root) to make sure you are the owner.

  3. #3
    Just Joined!
    Join Date
    Sep 2004
    Posts
    5
    Quote Originally Posted by Optimistic
    Sure. Root has access to everything, so just su to root and chmod them back to their original permissions.
    When I tried that and it didn't work. I did an su to root and tried to do an "ls -la" but none of the files showd up.

    I'm pretty sure I can do the chmod 421 [filename] thing, but since I did the whole directory, I do not know ANY of the filenames.

    I even tried "chmod a+x *" when I was logged in as root but it says "*: no such file or directory"

    Is there another way I can save these files?

    Thanks,
    Ryan

  4. #4
    Linux User
    Join Date
    Feb 2005
    Posts
    290
    which directory did you mess up and in which directory do you try to ls -al ? is the directory NFS'ed or smbmount'ed ? or is it just an empty directory?

    as root user, you can do anything and see anything unless (the possibility that i can think of):
    1) SELinux is enabled (FC3 included this as an option)
    2) your ls is messed up ... (trojan?)

    paste your shell session here (with pwd, ls, error message, more details)

  5. #5
    Linux Enthusiast
    Join Date
    Feb 2005
    Location
    SE, Stockholm
    Posts
    512
    An easy way to be able listing the files once again is to issue as root from the directory where you previous "messed up"

    Code:
    chmod -R +r *

  6. #6
    Just Joined!
    Join Date
    Sep 2004
    Posts
    5
    Quote Originally Posted by adam7979
    which directory did you mess up and in which directory do you try to ls -al ? is the directory NFS'ed or smbmount'ed ? or is it just an empty directory?
    I guess I should mention I'm running Mac OS X Panther. The file system is Mac OS Extended (Journaled). I was hoping Darwin ran the same way as most BSD/Linux OSes. I supposed Apple did something different with their superuser becuase I'd be able to see all those files, huh?

    The directory does have files in it, I'm sure of it. I never issued a rm or mv or anything that would change their location. I was just playing around with chmod.

    Here is my shell session:
    Code:
    Ryapple:/Users/ryans/Pictures/Lakers ryansamiley$ su root
    Password:
    Ryapple:/Users/ryans/Pictures/Lakers root# ls
    .DS_Store
    Ryapple:/Users/ryans/Pictures/Lakers root# ls -la
    total 0
    drwxrwxrwx   3 ryans  ryans   102  9 Mar 23:44 .
    drwx------  30 ryans  ryans  1020  9 Mar 12:04 ..
    -r--r--r--   1 ryans  ryans     0  9 Mar 23:44 .DS_Store
    Ryapple:/Users/ryans/Pictures/Lakers root# chmod -R +r *
    chmod: *: No such file or directory
    Ryapple:/Users/ryans/Pictures/Lakers root#
    I really appreicate your help guys,
    Ryan

  7. #7
    Just Joined!
    Join Date
    Nov 2004
    Posts
    17
    One possibility: in order to see files in a particular directory the directory must be searchable. So, hop up a directory and see what the permissions are of the directory.

  8. #8
    Linux User
    Join Date
    Feb 2005
    Posts
    290
    you mean there are (were) plenty of files in /usrs/ryans/pictures/lakers ? If it's true, erm.... beat me....

    ls -al gives you .DS_Store, a . in front of a file means it's a hidden file (good old *nix terminology). To chmod a "hidden" file, you should use

    Code:
    chmod 755 .*

    good luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •