Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
28
rated 0 times [  28] [ 0]  / answers: 1 / hits: 89266  / 1 Year ago, fri, january 6, 2023, 4:57:34

What is the difference between:



sudo chown $USER:$USER


and



sudo chown $USER


Why is it 2 times? Is the one user wrong? When I look at permissions with namei -l, I often see things like root root or proxy proxy.



Why does the owner have to be defined and listed 2 times?


More From » permissions

 Answers
0

The chown command is used to change the owner and group owner of a file or directory.
Superuser privileges are required to use this command. The syntax of chown looks like
this:



chown [owner][:[group]] file...


chown can change the file owner and/or the file group owner depending on the first argument of the command. Here are some examples:



chown owner file example:



chown bob file --> Changes the ownership of the file from its current owner to user bob.


chown owner:group file example:



chown bob:users file --> Changes the ownership of the file from its current owner to user bob and changes the file group owner to group users.


chown :group file example:



 chown :admins file --> Changes the group owner to the group admins. The file owner is unchanged.


chown owner: file example:



chown bob: file --> Change the file owner from the current owner to user bob and changes the group owner to the login group of user bob.


Please read this nice tutorial https://www.linode.com/docs/tools-reference/linux-users-and-groups. This show some info about user, groups ,permissions ,...


[#19825] Saturday, January 7, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mance

Total Points: 198
Total Questions: 105
Total Answers: 128

Location: South Georgia
Member since Mon, Aug 16, 2021
3 Years ago
;