Results 1 to 9 of 9

Thread: how to restore deault file permisions of home directory?

  1. #1
    mtataol NNTP User

    Unhappy how to restore deault file permisions of home directory?

    Hi,

    I used this command in suse 11.1

    chmod -R 777 "user directory"

    where "user directory" is the name of my home directory. Is there anyway to restore the default permissions of s home directory?

  2. #2
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,857
    Blog Entries
    20

    Default Re: how to restore deault file permisions of home directory?

    Who is listed as the owner currently?
    Tumbleweed_KDE
    My Articles Was I any help? If yes: Click the star below

  3. #3
    platinum NNTP User

    Default Re: how to restore deault file permisions of home directory?

    > chmod -R 777 "user directory"

    i have to wonder who (and where) you picked up the idea that doing
    that was a good thing to do? and, tell us what you were trying to
    'fix' by doing it..

    and, can you ask him/her what to do now since you system is toast??

    at the very least you should let us know where it came from so we can
    put the word out that that person/site/mail list/blog whatever is
    killing linux systems (probably intentionally...it is kinda like that
    'virus' that went around giving step by step directions to clean a
    non-existent virus by deleting the CWindows directory--thousands of
    folks killed their own system)..

    i can't do better for you because i've never actually used chmod,
    ever...but, stick around, someone must know how to recover short of
    the Redmond Cure-ALL (reinstall)

    --
    platinum

  4. #4
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: how to restore deault file permisions of home directory?

    Code:
    chmod -R 755 /home/username
    or, same thing
    Code:
    chmod u=rwx,g=rx,o=rx /home/username
    Reference: Notes on chown and chmod
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  5. #5
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: how to restore deault file permisions of home directory?

    Quote Originally Posted by swerdna View Post
    Code:
    chmod -R 755 /home/username
    or, same thing
    Code:
    chmod -R u=rwx,g=rx,o=rx /home/username
    Reference: Notes on chown and chmod
    That will revert 99% of them. The other 1%, well, a bit of a security flaw but nothing to worry over.
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  6. #6
    Join Date
    Mar 2009
    Location
    London
    Posts
    426

    Default Re: how to restore deault file permisions of home directory?

    I don't know of any undo commands for chmod, but I would advise removing write and execute permissions for other and group

    Code:
    chmod 'chmod -R go-wx "user directory"
    and remove read permissions for documents directory

    Code:
    chmod 'chmod -R go-r "user directory"/Documents
    This isn't a perfect solution, but will get the permissions quite close to correct.

    If you have another user account, from the home directory of the other user use:

    Code:
    ls -l
    and make a note of the permissions, then go to your account and chmod on User Group Other to + or - Read Write eXecute to match the other account.

    if you get stuck use:

    Code:
    chmod --help
    Good luck,
    Barry.

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,720

    Default Re: how to restore deault file permisions of home directory?

    Quote Originally Posted by mtataol View Post
    Hi,

    I used this command in suse 11.1

    chmod -R 777 "user directory"

    where "user directory" is the name of my home directory. Is there anyway to restore the default permissions of s home directory?
    For only the home directory it should be drwxr-xr-x (or chmod 755). But for the -R option you can't.

    The thing that comes nearest to it is using your latest backup and looking in there what the directories/files you had at the time of backup had as access bits at the time of backup. When you belong to those that never take backups because they never do anything stupid (like rm -r or chmod -R) and will never will have a faulty disk, you do not even have that possibility.

    Apart from the advices given by others above, you must be aware of the fact that e.g. the x-bits are set for user/group for each and every file. So in places where you have only data files (like your pictures or your music) you could do a
    Code:
    chmod a-x *.mp3
    as an example.

    More intelligent guessing (and checking by e.g. doing first an ls -r *.dontknow BEFORE doing chmod -R g-w *.dontknow) from your side may improve the situation over time.

    Be glad you did not do this as root in / (there is always a bright side )
    Henk van Velden

  8. #8

    Default Re: how to restore deault file permisions of home directory?

    Code:
    find ~ -type d -exec chmod 755 {} \;
    
    find ~ -type f -exec chmod 644 {} \;
    And then maybe also (if one has scripts/executables in $HOME/bin which is also in $PATH):

    Code:
    find ~/bin/ -type f -exec chmod 755 {} \;

  9. #9
    platinum NNTP User

    Default Re: how to restore deault file permisions of home directory?

    platinum wrote:
    >> chmod -R 777 "user directory"

    >
    > i have to wonder who (and where) you picked up the idea


    i really would like to know where s/he got the idea to enter that
    command...(i'm just enough a conspiracies searcher to believe it could
    be our friends from Redmond sowing their FUD in yet another way..)

    well, this is mtataol's first and only posting here, maybe he just
    came (from a Washington State campus) to see how many of us were
    stupid enough to do that command on our system to see what happened..

    a non-exhaustive review of the results of googling "chmod -R 777"
    indicates lots of folks trying to 'fix' access permission problems in
    various areas with it, and failing..

    --
    platinum

Posting Permissions

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