Junior — Middle
How can the owner of a file be changed in the Linux operating system?
sobes.tech AI
Answer from AI
In Linux, the chown command is used to change the owner of a file.
Syntax:
chown [new_owner] [file_path]
For example, to change the owner of the file example.txt to the user user1:
chown user1 example.txt
If you want to change both the owner and the group, you can specify them separated by a colon:
chown user1:group1 example.txt
Executing this command usually requires superuser (root) privileges, so sudo is often used:
sudo chown user1 example.txt