How to change file user ownership?

QuestionsQuestions8 SkillsProPermissions of FilesOct, 04 2025
097

To change the user ownership of a file, you can use the chown command. The syntax is as follows:

sudo chown newuser filename

Replace newuser with the username of the new owner and filename with the name of the file.

For example, to change the ownership of example.txt to a user named john, you would run:

sudo chown john example.txt

This command requires superuser privileges, which is why sudo is used. After executing the command, you can verify the change by using:

ls -l filename

This will show the new owner of the file.

0 Comments

no data
Be the first to share your comment!