0
0
Linux CLIscripting~5 mins

chown (change ownership) in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the chown command do in Linux?
The chown command changes the owner and/or group of a file or directory.
Click to reveal answer
beginner
How do you change the owner of a file named report.txt to user alice?
Use the command: chown alice report.txt to change the owner to alice.
Click to reveal answer
intermediate
How can you change both the owner to bob and the group to staff for a file data.csv?
Use chown bob:staff data.csv to change owner to bob and group to staff.
Click to reveal answer
intermediate
What option do you use with chown to change ownership recursively for all files and folders inside a directory?
Use the -R option, like chown -R alice folder/, to change ownership recursively.
Click to reveal answer
beginner
Why do you need superuser (root) privileges to use chown?
Changing ownership affects system security, so only the superuser can change file owners to prevent unauthorized access.
Click to reveal answer
Which command changes the owner of file.txt to user john?
Achmod john file.txt
Bchown john file.txt
Cchown file.txt john
Dchgrp john file.txt
How do you change the owner and group of doc.pdf to mary and editors respectively?
Achown mary:editors doc.pdf
Bchown editors:mary doc.pdf
Cchown doc.pdf mary editors
Dchmod mary:editors doc.pdf
What does the -R option do in chown?
ARuns command in read-only mode
BRestores previous ownership
CChanges ownership recursively for directories and files inside
DRemoves ownership
Who can use chown to change file ownership?
AOnly the superuser (root)
BAny user on the system
COnly the file owner
DOnly users in the same group
What happens if you run chown alice file.txt but you are not root?
AFile permissions change instead
BOwnership changes successfully
CFile is deleted
DYou get a permission denied error
Explain how to change the owner and group of a file using chown. Include an example.
Think about the format with colon separating owner and group.
You got /3 concepts.
    Describe why changing file ownership requires superuser privileges and what could happen if it didn't.
    Consider what ownership means for file access.
    You got /4 concepts.