Cannot delete directory via File Manager: Error occurred during /bin/rm command

Created:

2016-12-18 06:41:25 UTC

Modified:

2017-08-08 13:24:49 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Cannot delete directory via File Manager: Error occurred during /bin/rm command

Applicable to:

  • Plesk for Linux

Symptoms

An error occurs during removing a directory or a file through File Manager in Plesk

    Unable to remove /var/www/vhosts/example.com/httpdocs/somedirectory: filemng failed: filemng: Error occurred during /bin/rm command.

Debug log /var/log/plesk/panel.log shows the following errors:

    [2016-12-08 11:13:31] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/filemng' 'db_id' 'rm' '-rf' '/var/www/vhosts/example.com/httpdocs/somedirectory'] with exit code [1]
[2016-12-08 11:13:31] DEBUG [util_exec] [2effbbe0568a3e1d07b3fd3144df9181][0] Finished in 0.04514s, Error code: 1, stdout: rm: cannot remove `/var/www/vhosts/example.com/httpdocs/somedirectory/sites/default/default.settings.php': Permission denied
rm: cannot remove `/var/www/vhosts/example.com/httpdocs/somedirectory/sites/default/settings.php': Permission denied
rm: cannot remove `/var/www/vhosts/example.com/httpdocs/somedirectory/sites/default/files': Permission denied
filemng: Error occurred during /bin/rm command.
, stderr: filemng: Error occurred during /bin/rm command.

[2016-12-08 11:13:31] ERR [1] PleskUtilException: '/usr/local/psa/admin/bin/filemng' 'db_id' 'rm' '-rf' '/var/www/vhosts/example.com/httpdocs/somedirectory' failed with code 1.

stdout:
rm: cannot remove `/var/www/vhosts/example.com/httpdocs/somedirectory/sites/default/default.settings.php': Permission denied
rm: cannot remove `/var/www/vhosts/example.com/httpdocs/somedirectory/sites/default/settings.php': Permission denied
rm: cannot remove `/var/www/vhosts/example.com/httpdocs/somedirectory/sites/default/files': Permission denied
filemng: Error occurred during /bin/rm command.


stderr:
filemng: Error occurred during /bin/rm command.

Cause

There is a directory with wrong permissions under the /var/www/vhosts/example.com/httpdocs/somedirectory/

Resolution

  1. Find the owner of the directory:
    [root@server ~]# ls -la /var/www/vhosts/ | grep example.com
    drwxr-xr-x 3 user psacln 4096 Nov 21 17:06 example.com

    In the output above the username is user.

  2. Try to delete the directory:
    # sudo -u user rm -rf /var/www/vhosts/example.com/httpdocs/somedirectory
  3. If the following error occurs, proceed to step 4:

    rm: cannot remove `somedirectory': Permission denied
  4. Check permissions for files and the subdirectories. Directory or file with the following permissions is the root cause of the issue:
    [root@server ~]# ls -la /var/www/vhosts/example.com/httpdocs/somedirectory/sites/
    dr-xr-xr-x 3 user psacln 4096 Dec 8 17:47 default

    Such directory with permissions 555 can be managed by root only and another user cannot delete files in it.

  5. Change the directory permissions to 755:
    # chmod 755 /var/www/vhosts/example.com/httpdocs/somedirectory/sites/default
Have more questions? Submit a request
Please sign in to leave a comment.