[berry@berry:practice] ls -lrt
total
-rwxrwxrwx berry berry Dec : f1.txt
-rwxrwxrwx berry berry Dec : f2.txt
-rwxrwxrwx berry berry Dec : f3.txt
[berry@berry:practice] chown guest:guest f1.txt
chown: changing ownership of ‘f1.txt’: Operation not permitted
[berry@berry:practice] ls -lrt
total
-rwxrwxrwx berry berry Dec : f1.txt
-rwxrwxrwx berry berry Dec : f2.txt
-rwxrwxrwx berry berry Dec : f3.txt
[berry@berry:practice] chown root:root f1.txt
chown: changing ownership of ‘f1.txt’: Operation not permitted
[berry@berry:practice] sudo chown guest:guest f1.txt
[berry@berry:practice] ls -lrt
total
-rwxrwxrwx guest guest Dec : f1.txt
-rwxrwxrwx berry berry Dec : f2.txt
-rwxrwxrwx berry berry Dec : f3.txt
其实这应该是权限的问题。首先你要知道,root为最高权限用户,而你当前的用户为berry。
其权限低于root,所以将文件拥有者改为root时会出现问题。
假如你当前用户为root,将文件权限赋给berry,或者root等其他用户,那么将是成功的。
(1)sudo能解决问题。
(2)先su到root用户,然后chown root:root f2.txt更改权限,在exit退出root用户,在此时查看文件权限已经更改了。