[berry@berry:practice] ls -lrt total 12 -rwxrwxrwx 1 berry berry 84 Dec 16 10:20 f1.txt -rwxrwxrwx 1 berry berry 206 Dec 16 10:51 f2.txt -rwxrwxrwx 1 berry berry 372 Dec 16 14:26 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 12 -rwxrwxrwx 1 berry berry 84 Dec 16 10:20 f1.txt -rwxrwxrwx 1 berry berry 206 Dec 16 10:51 f2.txt -rwxrwxrwx 1 berry berry 372 Dec 16 14:26 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 12 -rwxrwxrwx 1 guest guest 84 Dec 16 10:20 f1.txt -rwxrwxrwx 1 berry berry 206 Dec 16 10:51 f2.txt -rwxrwxrwx 1 berry berry 372 Dec 16 14:26 f3.txt
其实这应该是权限的问题。首先你要知道,root为最高权限用户,而你当前的用户为berry。
其权限低于root,所以将文件拥有者改为root时会出现问题。
假如你当前用户为root,将文件权限赋给berry,或者root等其他用户,那么将是成功的。
(1)sudo能解决问题。
(2)先su到root用户,然后chown root:root f2.txt更改权限,在exit退出root用户,在此时查看文件权限已经更改了。