Linux Change file owner Command chown command use confusion

Source: Internet
Author: User

[Email protected]:p Ractice] LS-Lrttotal A-rwxrwxrwx1Berry Berry -Dec - Ten: -F1.txt-rwxrwxrwx1Berry Berry206Dec - Ten:WuyiF2.txt-rwxrwxrwx1Berry Berry372Dec -  -: -F3.txt[[email protected]:p Ractice] chown guest:guest f1.txt chown:changing ownership of ' f1.txt ': Operation not Perm Itted[[email protected]:p Ractice] LS-Lrttotal A-rwxrwxrwx1Berry Berry -Dec - Ten: -F1.txt-rwxrwxrwx1Berry Berry206Dec - Ten:WuyiF2.txt-rwxrwxrwx1Berry Berry372Dec -  -: -F3.txt[[email protected]:p Ractice] chown root:root f1.txt chown:changing ownership of ' f1.txt ': Operation not permit Ted[[email protected]:p Ractice] sudo chown guest:guest f1.txt [[email protected]:p Ractice] LS-Lrttotal A-rwxrwxrwx1Guest Guest -Dec - Ten: -F1.txt-rwxrwxrwx1Berry Berry206Dec - Ten:WuyiF2.txt-rwxrwxrwx1Berry Berry372Dec -  -: -F3.txt

In fact, this should be a matter of authority. First you need to know that root is the highest-privileged user and your current user is Berry.

Its permissions are lower than root, so a problem occurs when the file owner is changed to root.

If your current user is root and assigns file permissions to Berry, or to other users such as root, then it will be successful.

(1) sudo can solve the problem.

(2) First su to the root user, and then chown root:root f2.txt Change permissions, exit the root user at exit, at this time to view the file permissions have changed.

Linux Change file owner Command chown command use confusion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.