Changing back to default permissions

Server Admin

When modifying file permissions it is sometimes necessary to go back to the drawing board and set back to the default permissions. The following command can be used via ssh and takes a couple seconds vs trying to do this via ftp file by file (which can take a very long time depending on the size of your website)

Change to the directory you want changed, then run these;

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
 

Will set permission for all files to 644 and all directories to 755.

This works for pretty much any Linux server.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Technorati
  • Yahoo! Bookmarks
  • email

2 Comments

  1. Im assuming if you only needed to adjust one website worth of files you would put the dir location at the end of that command where the slash is?

  2. Dustin says:

    The above example you first cd to the directory you want to change. All files/folders under that directory will be affected.

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>