How To Change User Of a File In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Use the chown command to change the user associated with a file.
The syntax is:
chown <user> <file>
Example:
chown bob /home/bob/test.txt
This will change the owner of the file test.txt to user bob.
2. Use the chgrp command to change the group associated with a file.
The syntax is:
chgrp <group> <file>
Example:
chgrp mygroup /home/bob/test.txt
This will change the group of the file test.txt to mygroup.