Can chown be used to change the ownership of files without affecting their subdirectories?

QuestionsQuestions8 SkillsProPermissions of FilesAug, 23 2025
0178

Yes, the chown command can be used to change the ownership of files without affecting their subdirectories by omitting the -R (recursive) option.

For example, if you want to change the ownership of all files in a directory but not the subdirectories, you can run:

sudo chown user:group /path/to/directory/*

This command will change the ownership of all files directly within the specified directory but will leave any subdirectories unchanged.

If you want to change ownership for a specific file, you can simply specify that file:

sudo chown user:group filename

If you have further questions or need more examples, feel free to ask!

0 Comments

no data
Be the first to share your comment!