chattr: Operation not supported while reading flags

When making a file immutable with chattr command, I get the following error

[root@vps784847 vhosts]# chattr +i serverok.in.conf 
chattr: Operation not supported while reading flags on serverok.in.conf
[root@vps784847 vhosts]#

The error was due to the file I was trying to chattr being a symlink, not a real file.

[root@vps784847 vhosts]# ls -la
total 0
drwxr-xr-x. 2 root root  31 Oct 27 08:11 .
drwxr-xr-x. 7 root root 131 Jun  1 02:03 ..
lrwxrwxrwx. 1 root root  51 Jul 24 12:39 serverok.in.conf -> /var/www/vhosts/system/serverok.in/conf/nginx.conf
[root@vps784847 vhosts]# 

To fix the error, chattr the actual file.

chattr +i /var/www/vhosts/system/serverok.in/conf/nginx.conf

Back to Linux Commands

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *