Results 1 to 7 of 7

Thread: Did a chmod -R 755 to everything in $HOME. How to come back ?

  1. #1
    Join Date
    Aug 2010
    Beans
    2

    Red face Did a chmod -R 755 to everything in $HOME. How to come back ?

    Hello,

    Everything's in the title :

    I did a chmod -R 755 to everything in $HOME.
    That was a really idiot manipulation because all the files (even not exe files) can now be executed.

    Thanks!

  2. #2
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Did a chmod -R 755 to everything in $HOME. How to come back ?

    try something like this

    Code:
    find ~ -type f -exec chmod -x {} \;
    = find all files (-type f) in your homedir (~) and clear executable bit (chmod -x) on them ({} stands for the name of a matching item). Read about find and chmod to know what your options are (find --help, chmod --help), it's a very useful knowledge. Especially find is good to be friends with, you can do a lot with it

    probably it's not the best idea to run the command on the whole home dir (find ~), as it will affect also true executable files you may have in various places (custom scripts, wine programs, ...). You can fine tune the find command to be more specific (for example ~/Music instead of ~, add some additional conditions on file names, etc). Do some research and test it on some dummy set of files to be sure you know what should happen.
    Last edited by Vaphell; November 16th, 2010 at 05:46 PM.

  3. #3
    Join Date
    Mar 2010
    Beans
    8,759
    Distro
    Ubuntu Mate

    Re: Did a chmod -R 755 to everything in $HOME. How to come back ?

    No disrespect intended to Vaphell, but I have something better:

    To change permissions back to the defaults:
    Code:
    find ~ -type d -exec chmod 0755 '{}' +;
    find ~ -type f -exec chmod 0644 '{}' +;
    Then, to set permissions for the home directory:
    Code:
    chmod 0700 ~
    http://ubuntuforums.org/showpost.php...18&postcount=2

    You can then check by using
    Code:
    ls -ld ~
    and what you should see is that the permissions for the home directory are drwx.
    Last edited by Rubi1200; November 16th, 2010 at 06:14 PM.

  4. #4
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Did a chmod -R 755 to everything in $HOME. How to come back ?

    no offense taken, there is more than 1 way to skin a cat i focused mainly on +x issue and i simply dislike running recursive, broad scope commands because way too often they cause as much trouble as the problem they fix. Resetting permissions to default is easy but is not the end if you happen to have a lot of executables that need to have their +x restored. I wanted to point that out and encourage OP to learn few handy tricks in the process

  5. #5
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Did a chmod -R 755 to everything in $HOME. How to come back ?

    Running chmod -x on a file with 0755 permissions is the same as running chmod 0644, so there is nothing wrong with that.

    I would use the -exec command '{}' + syntax, which runs the command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files.

    Quote Originally Posted by Vaphell View Post
    Resetting permissions to default is easy but is not the end if you happen to have a lot of executables that need to have their +x restored.
    That shouldn't be a big issue for one who keeps their files organized (i.e. all executables in ~/bin or ~/.bin).

    Of course, wine could be problematic, yeh, Windows filesystem hierarchy...

  6. #6
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,287
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Did a chmod -R 755 to everything in $HOME. How to come back ?

    Quote Originally Posted by sisco311 View Post
    I would use the -exec command '{}' + syntax, which runs the command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files.
    Thank you. I didn't know about the + version.

  7. #7
    Join Date
    Oct 2004
    Location
    Cupertino, CA
    Beans
    5,092
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Did a chmod -R 755 to everything in $HOME. How to come back ?

    This is one reason why you should consider the chmod symbolic name syntax as opposed to an octal permissions mode. Namely, the capital X specifier would've done a better job at doing what you presumably wanted to do.

    See the description in the chmod manpage: http://manpages.ubuntu.com/manpages/...1/chmod.1.html
    Quote Originally Posted by tuxradar
    Linux's audio architecture is more like the layers of the Earth's crust than the network model, with lower levels occasionally erupting on to the surface, causing confusion and distress, and upper layers moving to displace the underlying technology that was originally hidden

Tags for this Thread

Bookmarks

Posting Permissions

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