Permissions for Newly Created Directories and Files on cPanel VPS

Via VPS shell, new files and directories are created with permissions 664 and 775, respectively. However…

The following is the general correct permissions…

600 PHP Scripts (including those that say they want to be 777)
400 Rare case where PHP scripts don’t want to be writable
755 CGI Scripts (*.pl, and *.cgi)
644 Non-Script Files (*.html, *.css, *.jpg, *.gif, etc …)
755 ALL folders beneath public_html
750 public_html folder itself (owner:nobody)

(Source: CPanel.net)

Useful commands:

Chmod directories only

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

(Source: LinuxQuestions.org)

 

Recursively chmod only files

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

Recursively chmod only PHP files (with extension .php)

find . -type f -name ‘*.php’ -exec chmod 644 {} \;

(Source: ChrisGilligan.com)

 

Advertisements

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: