I want to delete the folder under root writes an error

/var/www ⌚ 16:35:54
$ ll
drwxrwxrwx. 2 ftp_user ftp_user    6 апр 24 16:46 cgi-bin
drwxrwxr-x  5 nginx    nginx    4,0K июл 10 12:42 site.com
drwxrwxrwx. 2 ftp_user ftp_user    6 апр 24 16:46 html

Write to remove

/var/www ⌚ 16:35:56
$ rm -rf site.com
  rm: it is impossible to remove «site.com/logs»: permissions denied
  rm: it is impossible to remove «site.com/public»: permissions denied
  rm: it is impossible to remove «site.com/ocStore-3.zip»:  permissions denied

Trying to change ownership

/var/www ⌚ 16:36:49
$ chown -R root:root site.com
  chown: change owner "site.com": Operation not allowed

Under whom I work

/var/www ⌚ 16:42:17
$ whoami

I don't remember what I did or why it became like this.

OS Oracle Linux 7.6 UEK

Reply to comments

$ df /var/www
Filesystem   1K-blocks   Used     Available  Used%   Mounted in
/dev/vda3    18338816    3295488  15043328   18%     / 

$ ls -ld /var/www
drwxr-xr-x. 5 ftp_user ftp_user 61 июл 11 19:36 /var/www

$ id
uid=0(root) gid=0(root) groups=0(root)

I come through ssh under root "ssh [email protected] -p 22"
Was my zsh(Oh my zsh plugin)
  • 1
    Are you sure /var/www isn't a mount-point? That's often how root doesn't have access to things, because it's not hosted on the machine itself. Try df /var/www and note the Filesystem (and update your question with the result of that command maybe).
    – Centimane
    Jul 11, 2019 at 13:57
  • 2
    You have some flags or ACLs set on the cgi-bin and the html directories (the dot at the end of the permission string). Could you please show the output of ls -ld /var/www so we can see the permissions on that directory too?
    – Kusalananda
    Jul 11, 2019 at 14:01
  • File system /dev/vda3 and drwxrwxrwx. 10 ftp_user ftp_user 4096 июл 11 18:31 /var/www Jul 11, 2019 at 15:40
  • At the risk of asking a dumb question, is root really root?  Can you explain why your shell prompt ends with $ instead of #?  How did you become root?  (Did you login as root? Did you run su? Did you run sudo? If you ran sudo, what was the exact command?)  What output do you get if you run id? … … … … … … … … … … … … Please do not respond in comments; edit your question to make it clearer and more complete. Jul 11, 2019 at 18:01

1 Answer 1


A number of things could be wrong here. From my own experience, I recommend checking the directory attributes with the lsattr utility. Often times I set the immutable bit on files to prevent accidental modification, and to slightly slow down any malicious person from messing with it. If the flag is indeed set, simply remove it: chattr -R -i /var/www

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .