Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

bash - SuiteCRM - fix file permissions

I am trying to update the file permissions for SuiteCRM.

I need to run the following code in GNU bash, but I cannot figure out the correct syntax to list the file permissions.

I am the root user

sudo chown -R www-data:www-data .

sudo chmod -R 755 .

sudo chmod -R 775 cache custom modules themes data upload

sudo chmod 775 config_override.php 2>/dev/null

Version is GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu) correct syntax for file permissions

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For SuiteCRM this is what I do for resetting permissions (you have to be root before executing)

Please adjust to your web server user (this one is for ubuntu )

find . -type d ! -path ./vendor -exec chmod 0755 {} ; &&  find . -type f ! -path ./vendor -exec chmod 0644 {} ; 
chmod -R 775 cache custom modules themes data upload  config_override.php  config.php
chown -R www-data:www-data .

For redhat the apache webserver usually runs as apache user so you should run:

find . -type d ! -path ./vendor -exec chmod 0755 {} ; &&  find . -type f ! -path ./vendor -exec chmod 0644 {} ; 
chmod -R 775 cache custom modules themes data upload  config_override.php  config.php
chown -R apache:apache .

The first line makes sure all files are 644 and all folders are 755 just to make sure you don't have weird permissions.

Last but not least, ONLY in the case that someone has SuPHP you will need to run chown apache.nobody ./ for redhat and chown www-data.nobody ./ as apache usually runs as nobody and needs access to the root folder + SuPHP might complain of group write permissions on some folders so adjust :)

EDIT: Excluded the vendor folder which has its own file permissions needs (bin folder has executable files)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...