In the LAMP environment built on the Alibaba Cloud host, when modifying the properties of the related file config.cache.inc.php,
chmod 777 config.cache.inc.php
chmod: changing permissions of `config.cache.inc.php': Operation not permitted
, after a lot of trouble, I finally found out that chattr can be used to lift this restriction
. First, check the attribute
lsattr config.cache.inc.php
----i-------- config. cache.inc.php
chattr -i config.cache.inc.php
After this step, you can use chmod to modify the file attributes
I want to delete a file, but it prompts that the operation has no permission and is rejected.
[root@vmlin0342 php]# chmod -R u+w labs/config/conf
chmod: changing permissions of `labs/config/conf/redis.ini': Operation not permittedchmod: changing permissions of `labs/config/conf/mysql.ini': Operation not permitted
chmod: changing permissions of `labs/config/conf/zookeeper.ini': Operation not permitted
After searching, I found that chattr can modify the attributes of the file.
[root@vmlin0342 php]# chattr -i labs/config/conf/
[root@vmlin0342 php]# lsattr labs/config/conf/
----i-------- labs/config/conf/redis.ini
----i-------- labs/config/conf/mysql.ini
----i-------- labs/config/conf/zookeeper.ini
This will allow you to modify the file.
[root@vmlin0342 php]# chattr -R -i labs/config/conf/
[root@vmlin0342 php]#
[root@vmlin0342 php]# lsattr labs/config/conf/
------------- labs/config/conf/redis.ini
------------- labs/config/conf/mysql.ini
------------- labs/config/conf/zookeeper.ini
[root@vmlin0342 php]# chmod -R 777 labs/config/conf/
[root@vmlin0342 php]# rm -rf labs
[root@vmlin0342 php]# ls -al
total 8
drwxr-xr-x 2 root root 4096 Apr 21 11:34 .
drwxr-xr-x 6 root root 4096 Apr 21 11:26 ..
至此,文件属性被修改,文件也已经被删除
Exit code 126 from SFTP
$ /dev/null
-bash: /dev/null: Permission denied
$ echo $?
126
-rwxr-xr-x 1 root root 63552 Apr 11 2013 /path/to/sftp-server