User and Group Administration
User and Group Administration
Linux user accounts, Password and Its groups are found in this location:
It consists of 7 fields:
Note: Redhat 7, 8 used password hash sha256, sha512 and md5 (default sha512),
When the account is inactive it means user cannot access it and this account is
locked.
To create used account you must login with root account or you have privilege to
create account like sudoers file.
[root@server ~]#userdel mahmoud ==> this command delete the account without
removing his/her home directory.
[root@server ~]#userdel -r mahmoud ==> will delete the account, primary group,
mail account and its home directory.
Note: When the user has left the company the administrator may lock and expire an
account with a single command usermod and note that the date must be taken as the
number of days since 1970.01.01.
/etc/gshadow
groupname:password:gadmin:memberlist
[ali@server ~]$ w
18:30:51 up 10:35, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.10.1 13:39 4:49m 0.15s 0.15s -bash
Special Permissions:
setgid bit:
the setgid bit has effect on both files and directories. In the first case, the file which
has the setgid bit set, when executed, instead of running with the privileges of the
group of the user who started it, runs with those of the group which owns the file: in
other words, the group ID of the process will be the same of that of the file.
When used on a directory, instead, the setgid bit alters the standard behavior so that
the group of the files created inside said directory, will not be that of the user who
created them, but that of the parent directory itself. This is often used to ease the
sharing of files (files will be modifiable by all the users that are part of said group).
The setgid bit can easily be spotted (in this case on a /private/ directory):
Sticky bit:
The sticky bit works in a different way: while it has no effect on files, when used on
a directory, all the files in said directory will be modifiable only by their owners. A
typical case in which it is used, involves the /private/ directory. Typically this
directory is writable by all users on the system, so to make impossible for one user
to delete the files of another one.
In this case the owner, the group, and all other users, have full permissions on the
directory (read, write and execute). The sticky bit is identifiable by a t which is
reported where normally the executable x bit is shown, in the "other" section.
With this command we set the setgid bit on the directory, (identified by the first of
the four numbers), and gave full privileges on it to it's owner and to the user that are
members of the group the directory belongs to, plus read and execute permission for
all the other users (remember the execute bit on a directory means that a user is able
to cd into it or use ls to list its content).
The other way we can set the special permissions bits is to use the ugo/rwx syntax:
$ chmod g+s test
The use of special permissions can be very useful in some situations, but if not used
correctly the can introduce serious vulnerabilities, so think twice before using them.
Note:
Set gid =2
Sticky bit =1