Fedora
Fedora
Contents
Introduction to Users and Groups
User Private Groups
Shadow Passwords
Managing Users in a Graphical Environment
Using the Users Settings Tool
Using Command Line Tools
Adding a New User
Adding a New Group
Enabling Password Aging
Enabling Automatic Logouts
Creating Group Directories
Additional Resources
The control of users and groups is a core element of Fedora system administra-
1 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
tion. This chapter explains how to add, manage, and delete users and groups in
How to edit this page In this section
the graphical user interface and on the command line, and covers advanced
topics, such as creating group directories.
Additionally, Fedora supports access control lists (ACLs) for files and directories
which allow permissions for specific users outside of the owner to be set. For
more information about this feature, see the Access Control Lists chapter of the
Red Hat Enterprise Linux 7 System Administrators Guide.
User private groups make it safe to set default permissions for a newly created
file or directory, allowing both the user and the group of that user to make
modifications to the file or directory.
The setting which determines what permissions are applied to a newly created
2 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
Shadow Passwords
In environments with multiple users, it is very important to use shadow pass-
words provided by the shadow-utils package to enhance the security of system
authentication files. For this reason, the installation program enables shadow
passwords by default.
The following is a list of the advantages shadow passwords have over the tradi-
tional way of storing passwords on UNIX-based systems:
The chage utility for setting password-aging parameters. For details, see the
Password Security section in the Red Hat Enterprise Linux 7 Security Guide.
The usermod command with the -e, --expiredate or -f, --inactive op-
3 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
tion.
How to edit this page In this section
The useradd command with the -e, --expiredate or -f, --inactive op-
tion.
To make changes to the user accounts, first select the [ Unlock ] button and au-
thenticate yourself as indicated by the dialog box that appears. Note that un-
less you have superuser privileges, the application will prompt you to authenti-
cate as root . To add and remove users, select the [ + ] and [ - ] button respec-
tively. To add a user to the administrative group wheel , change the Account
Type from Standard to Administrator . To edit a user’s language setting, select
the language and a drop-down menu appears.
4 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
The commandline for call this Gui is : [user@domain ~]$ kcmshell5 user_man-
ager When a new user is created, the account is disabled until a password is
set. The Add User menu contains the options to set a password by the adminis-
trator immediately, or to allow the user to choose a password at the first login.
Utilities Description
5 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
Utilities Description
How to edit this page In this section
passwd username
Optionally, you can set a password aging policy. See Enabling Password Aging
for information on how to enable password aging.
Option Description
6 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
Option Description
How to edit this page In this section
The command-line options associated with the usermod command are essen-
tially the same. Note that if you want to add a user to another supplementary
group, you need to use the -a, --append option with the -G option. Otherwise
the list of supplementary groups for the user will be overwritten by those speci-
fied with the usermod -G command.
7 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
juan:x:1001:1001::/home/juan:/bin/bash
There is an x for the password field indicating that the system is using
shadow passwords.
A UID greater than 999 is created. Under Fedora, UIDs below 1000 are
reserved for system use and should not be assigned to users.
A GID greater than 999 is created. Under Fedora, GIDs below 1000 are
reserved for system use and should not be assigned to users.
The optional GECOS information is left blank. The GECOS field can be
used to provide additional information about the user, such as their full
name or phone number.
The home directory for juan is set to /home/juan/ .
juan:!!:14798:0:99999:7:::
Note
Note
If an encrypted password is passed using the -p flag, it is placed in the
/etc/shadow file on the new line for the user.
8 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
juan:x:1001:
A group with the same name as a user is called a user private group. For
more information on user private groups, see User Private Groups.
juan:!::
This directory is owned by user juan and group juan . It has read, write,
and execute privileges only for the user juan . All other permissions are de-
nied.
9 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
The files within the /etc/skel/ directory (which contain default user set-
How to edit this page In this section
tings) are copied into the new /home/juan/ directory. The contents of
/etc/skel/ may vary depending on installed applications:
At this point, a locked account called juan exists on the system. To activate it,
the administrator must next assign a password to the account using the
passwd command and, optionally, set password aging guidelines.
Option Description
10 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
Option Description
How to edit this page In this section
-p , --password password Use this encrypted password for the new group.
Important
Shadow passwords must be enabled to use chage
Shadow passwords must be enabled to use the chage command. For more informa-
tion, see Shadow Passwords.
To configure password expiration for a user from a shell prompt, run the fol-
lowing command as root :
…where options are command line options as described in chage command line
options. When the chage command is followed directly by a username (that is,
when no command line options are specified), it displays the specified users
current password aging values and allows you to change these values interac-
tively.
Option Description
11 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
Option Description
How to edit this page In this section
You can configure a password to expire the first time a user logs in. This forces
users to change passwords immediately.
Set up an initial password. There are two common approaches to this step:
you can either assign a default password, or you can use a null password.
passwd username
12 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
passwd -d username
How to edit this page In this section
Warning
Avoid using null passwords whenever possible
Using a null password, while convenient, is a highly insecure practice, as any
third party can log in first and access the system using the insecure username.
Always make sure that the user is ready to log in before unlocking an account
with a null password.
chage -d 0 username
This command sets the value for the date the password was last changed
to the epoch (January 1, 1970). This value forces immediate password expi-
ration no matter what password aging policy, if any, is in place.
Upon the initial log in, the user is now prompted for a new password.
Make sure the screen package is installed. You can do so by running the
following command as root :
13 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
trap "" 1 2 3 15
Add the following lines at the end of the /etc/profile file to start a screen
session each time a user logs in to a virtual console or remotely:
SCREENEXEC="screen"
if [ -w $(tty) ]; then
trap "exec $SCREENEXEC" 1 2 3 15
echo -n 'Starting session in 10 seconds'
sleep 10
exec $SCREENEXEC
fi
Note that each time a new session starts, a message will be displayed and
the user will have to wait ten seconds. To adjust the time to wait before
starting a session, change the value after the sleep command.
Add the following lines to the /etc/screenrc configuration file to close the
screen session after a given period of inactivity:
This will set the time limit to 120 seconds. To adjust this limit, change the
value after the idle directive.
Alternatively, you can configure the system to only lock the session by using
the following lines instead:
The changes take effect the next time a user logs in to the system.
14 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
System administrators usually like to create a group for each major project and
assign people to the group when they need to access that project’s files. With
this traditional scheme, file management is difficult; when someone creates a
file, it is associated with the primary group to which they belong. When a single
person works on multiple projects, it becomes difficult to associate the right
files with the right group. However, with the UPG scheme, groups are automati-
cally assigned to files created within a directory with the setgid bit set. The set-
gid bit makes managing group projects that share a common directory very
simple because any files a user creates within the directory are owned by the
group that owns the directory.
For example, a group of people need to work on files in the /opt/myproject/ di-
rectory. Some people are trusted to modify the contents of this directory, but
not everyone.
mkdir /opt/myproject
groupadd myproject
Allow users in the group to create files within the directory and set the set-
gid bit:
15 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
At this point, all members of the myproject group can create and edit files
How to edit this page In this section
in the /opt/myproject/ directory without the administrator having to
change file permissions every time users write new files. To verify that the
permissions have been set correctly, run the following command:
Additional Resources
For more information on how to manage users and groups on Fedora, see the
resources listed below.
Installed Documentation
For information about various utilities for managing users and groups, see the
following manual pages:
useradd (8) — The manual page for the useradd command documents how
to use it to create new users.
userdel (8) — The manual page for the userdel command documents how
to use it to delete users.
usermod (8) — The manual page for the usermod command documents how
to use it to modify users.
groupadd (8) — The manual page for the groupadd command documents
how to use it to create new groups.
groupdel (8) — The manual page for the groupdel command documents
how to use it to delete groups.
groupmod (8) — The manual page for the groupmod command documents
16 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
grpck (8) — The manual page for the grpck command documents how to
use it to verify the integrity of the /etc/group file.
pwck (8) — The manual page for the pwck command documents how to use
it to verify the integrity of the /etc/passwd and /etc/shadow files.
pwconv (8) — The manual page for the pwconv, pwunconv, grpconv, and gr-
punconv commands documents how to convert shadowed information for
passwords and groups.
id (1) — The manual page for the id command documents how to display
user and group IDs.
group (5) — The manual page for the /etc/group file documents how to use
this file to define system groups.
passwd (5) — The manual page for the /etc/passwd file documents how to
use this file to define user information.
shadow (5) — The manual page for the /etc/shadow file documents how to
use this file to set passwords and account expiration information for the sys-
tem.
All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under
another accepted free and open content license.
17 of 18 27-06-2023, 01:43 pm
Managing Users and Groups :: Fedora Docs https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators...
18 of 18 27-06-2023, 01:43 pm