sh 重置Plesk服务器上所有Web根的权限和所有权

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 重置Plesk服务器上所有Web根的权限和所有权相关的知识,希望对你有一定的参考价值。

#!/bin/bash

# This script will find the username of each httpdocs folder in the vhosts folder 
# of a Plesk installation and set every file and folder inside that folder to be owned by that user
# It will also set files to 644 and folders to 755 permission. This is perfect for an installation using FastCGI/

VHOST_PATH="/var/www/vhosts"

echo "Performing operations on:"

cd "$VHOST_PATH"
for DIR in `ls -d -- */`
do
	
	# Check if file exists before attempting to perform operations
	if [ -f $CONFIG ]; then
			
		if [ -d "$DIR/httpdocs" ]; then
			USER=`stat -c "%U" $DIR/httpdocs`
			echo "$DIR - Owner set to $USER"

			find "$DIR/httpdocs" -type d -print0 | xargs -0 chmod 755
			find "$DIR/httpdocs" -type f -print0 | xargs -0 chmod 644

			chown -Rf $USER:psacln $DIR/httpdocs
			chown $USER:psaserv $DIR/httpdocs
		fi		
		
	fi
	
done

以上是关于sh 重置Plesk服务器上所有Web根的权限和所有权的主要内容,如果未能解决你的问题,请参考以下文章

Plesk 服务器 open_basedir 块

Plesk服务器上的所有邮件帐户用户/传递

TYPO3、Plesk 和权限

Plesk:访问外部公共文件夹

sh Plesk通过VPN转发流量

sh 显示电子邮件帐户plesk