One difference is that /etc/environment
contains only variable definitions and doesn't appear to go through any sort of variable expansion/interpolation. Thus, you can't reference variables in definitions. This for instance won't work:
A="else"
B="something $A"
B will literally be something $A
, not the expected something else
.
See this question.
By the way, the answer you found through Google appears to be referring to a user's ~/.bashrc
, rather than the system-wide /etc/bash.bashrc
. That may be causing your confusion.
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 ,...
Best Answer
The first digit in a four-digit permission is the sum of set user id (4), set group id (2) and sticky (1). A three-digit permission is just like a four-digit permission with the first digit set to zero. Thus:
Examples of uses for the fourth-digit permissions
If a file with set user ID is executed, then it is executed as if by the owner of the file rather than the user doing the executing. Thus, for example,
/bin/mount
is commonly owned by root and has permissions 4755 where the 4 signifies that, even if executed by a normal user, it will run with the owner's (root's) privileges.Setting group ID on a directory is useful for sharing files.
The sticky bit is used on directories like
/tmp
so that all users can create files but prevents non-owners from deleting other people's files. Thus, the permissions of/tmp
are typically 1777 where 1 signifies that the sticky bit is set.Documentation
From
man chmod
: