Hello and welcome to this introductory video on Oracle Linux.
This short video is a beginners level video covering topics on users and groups for Oracle
Linux.
After watching this video, you will learn:
What is a user account and home directory
Components of a user account
Changing user account login credentials
Changing ownership of a login session
The group topics to be covered are:
What is a group and creating a new group
A user is a login account on an operating system such as Oracle Linux.
Regular users can log in and use the operating system, but cannot administer the operating
system.
Only system administrators can run system binaries and view system files.
Using Oracle Linux, you create and manage users, and groups, using command-line tools
or a GUI tool.
The components of a user are:
A username which is a unique name for entering in and logging in to a system.
A password is a combination of numbers, letters, and special characters used to log in to a
system.
User identification number or UID is a unique number identifying a user in a system.
Group identification number or GID a unique number identifying a group to which a user
belongs.
Comment or General Electric Comprehensive Operating System or GECOS is simply information
identifying a user.
A user's home directory is a directory which is the place where a user logs in to and stores
files.
A user's login shell is the user's work environment setup.
Turning towards groups, a group is a collection of users who can share files and other system
resources.
Users working on the same project could be formed into a group.
Each group must have a group name, a group identification number or GID, and a list of
usernames that belong to the group.
Let's explore users and groups more.
Run the whoami command to find out which user account is logged in
As you can see, bob is the user.
A user's home directory is the directory where you are taken when you first log in to Oracle
Linux.
The home directory is where you create and organize all your files and subdirectories.
To go to bob's home directory, use the change directory or cd command.
To verify the present working directory, use the pwd command.
As you can see, bob is in the /home/bob directory.
Or you can use the cd command plus the tilde which takes the user to the same directory.
For changing user account login credentials, the passwd command allows you to update your
password when it expires or on when needed.
When changing a password there can be new password requirements such as:
The number of characters, numbers, and symbols used,
The minimum length of the password,
and if the password was used already.
To change bob's password, exit from the user bob to become root.
Next use the passwd command followed by the username bob.
Enter a new password.
Retype the new password again.
And the new password for bob has been updated.
For changing ownership of a login session, you can use the su command to change the ownership
of the current login session to another user.
The su command is commonly used to switch to the root user in Oracle Linux.
Let's now create a new user by the name of charlie.
Enter the command useradd followed by the name charlie.
# useradd charlie
You can modify a user's profile by using the usermod command.
To add a comment to a user's profile enter usermod -c for a comment such as new_account
followed by the user to modify which in this case is charlie
# usermod -c new_account charlie
To verify charlie's account was created and modified, use the cat command to view charlie's
information in the /etc/passwd file.
# cat /etc/passwd
As you can see, charlie's account was created successfully and the comment was also added.
You can also delete a user's account by using the userdel command followed by a user's account
name.
# userdel charlie
Use the cat command once again on /etc/passwd and we can see that the user charlie was removed.
# cat /etc/passwd
Let's add back charlie with the useradd command again since we'll need him for adding to one
of our groups later in this video.
# useradd charlie
As you can see charlie's home directory and mail are still intact because we did not specifically
delete them.
Let's switch to the user charlie using the su command.
The dash is used to instantiate the home directory and environment variables of the switched-to
user.
Now I'll verify I am the charlie user by once again running the whoami command.
Enter the exit command to exit from the user charlie.
Again, run the whoami command to verify I am root.
As a visual indicator, you can also tell if you are root when the prompt is a # sign.
Let's exit from root and return back to the user bob.
Again run the whoami command to verify who I am.
Let's verify the present working directory, use the pwd command.
Use the su command followed by the dash and username of another user to become that user.
Verify that charlie's home directory is the present working directory with the pwd command.
Lastly, use the cd command followed by the tilde and username to change to a user's home
directory.
The tilde is a pathname expansion of a user's home directory.
Again verify the present working directory is charlie's home directory.
Now run the groups command to see to which groups charlie belongs.
To view user and group IDs run the id command.
The first group listed is the primary group membership.
The GID number identifies the group internally to the system.
Another method for listing groups and GIDs is to view the /etc/group file.
The getent command can be used to show a listing of groupnames to GIDs on a system.
Now exit to root.
As root, you can create a new group and a specific GID by using the groupadd command.
The -g option specifies the GID number followed by the specific groupname.
Use the getent commmand once again to find and verify the new group name mygroup exists.
Finally, you can add members to a group by running the usermod command.
The -a option appends the user to a group specified by the -G option followed by the
groupname and user to add.
Next add charlie to the same group with bob.
For a final time, run the cat command to verify that both users are members of the new group
mygroup.
Oracle provides an extensive number of resources which you can use to learn more about this
subject and others.
Look for additional videos on Oracle Linux and other topics using the link shown.
This concludes the video.
Thank you for watching.