How To Fix FileOp Failure on: Directory not empty in cPanel

FileOp Failure on: Directory not empty
4.9/5 - (7 votes)

Here in this guide, i will show you how to fix FileOp failure permisiion in cpanel when you upload file or when you delete files. “FileOp Failure on: Directory not empty”.

1. Logged in as root user to the WHM server with SSH
2. Know the user name for the account you wish to reset
3. Have already installed the fixperms.sh script at /root/fixperms.sh.

Follow The steps

Create a File and copy and past these bellow code into the file and save with fixperms.sh

#######################################################
#!/bin/bash
# Script to fix permissions of accounts
# http://shahidmalla.com
 
if [ "$#" -lt "1" ];then
        echo "Must specify user"
        exit;
fi
 
[email protected]
 
for user in $USER
do
 
        HOMEDIR=$(grep $user /etc/passwd | cut -d: -f6)
 
        if [ ! -f /var/cpanel/users/$user ]; then
                echo "$user user file missing, likely an invalid user"
 
        elif [ "$HOMEDIR" == "" ];then
                echo "Couldn't determine home directory for $user"
 
        else
 
                echo "Setting ownership for user $user"
 
                        chown -R $user:$user $HOMEDIR
                        chmod 711 $HOMEDIR
                        chown $user:nobody $HOMEDIR/public_html $HOMEDIR/.htpasswds
                        chown $user:mail $HOMEDIR/etc $HOMEDIR/etc/*/shadow $HOMEDIR/etc/*/passwd
 
                echo "Setting permissions for user $USER"
 
                      find $HOMEDIR -type f -exec chmod 644 {} \; -print
                      find $HOMEDIR -type d -exec chmod 755 {} \; -print
                      find $HOMEDIR -type d -name cgi-bin -exec chmod 755 {} \; -print
                      find $HOMEDIR -type f \( -name “*.pl” -o -name “*.perl” \) -exec chmod 755 {} \; -print
                fi
done
#######################################################


then simply run the command and Replace {username} with the cpanel username you wish to repair.

/root/fixperms.sh {username}

Done.

Method 2(very simple way to fix FileOp Failure on: Directory not empty)

Steps to run fixperms on your VPS

1 Run Command:

wget https://shahidmalla.com/fixperms.sh

2. Running fixperms for all of the users

bash fixperms.sh cpanelaccountusername 

or run this if the first one does not work: sh fixperms.sh –all

For one single account:

Login using root

then run

bash fixperms.sh {cpanel username}

example: ./fixperms.sh serverconf

For all accounts:

sh fixperms.sh -v –all

sometime when you website get effected b malware or permission issue, this tutorial wil be very helpful for you to get your issue fixed.

Total
0
Shares
Leave a Reply

Your email address will not be published.

Previous Post
How to Host Domain On Ubuntu 21.10

How to Host Domain On Ubuntu 21.10 

Next Post
YUM encountered errors outside of EasyApache 4

YUM encountered errors outside of EasyApache 4

Related Posts
Total
0
Share