Log in and switch users in multiuser targets

1. Understand and Use Essential Tools

πŸ“˜Red Hat Certified System Administrator (RHCSA – EX200)


This is a very important objective in the RHCSA exam. You must understand:

  • How Linux handles multiple users
  • What multiuser targets are
  • How to log in locally and remotely
  • How to switch between users
  • How to become the root user safely
  • How to manage sessions correctly

The exam is performance-based, so you must know the exact commands and how to use them.


1. Understanding Multiuser in Linux

Linux is a multiuser operating system.

This means:

  • Multiple users can use the same system.
  • Different users can log in at the same time.
  • Each user has their own permissions and environment.

For example in an IT environment:

  • A system administrator manages the server.
  • A developer deploys applications.
  • A database administrator manages databases.
  • All of them may be logged in at the same time.

Linux controls this using systemd targets.


2. What is a Target?

Modern Red Hat Enterprise Linux uses systemd.

The main command to manage system state:

systemctl

In older Linux versions, we had β€œrunlevels”.
Now we use targets.

A target defines:

  • What services start
  • Whether graphical interface starts
  • Whether multiple users can log in

Important Targets for RHCSA

1️⃣ multi-user.target

This is the most important for the RHCSA exam.

Entity reference:

multi-user.target

This target:

  • Enables multi-user mode
  • Starts networking
  • Starts system services
  • Does NOT start graphical interface
  • Uses text-based login (CLI)

This is similar to old runlevel 3.


2️⃣ graphical.target

Entity reference:

graphical.target

This:

  • Starts everything in multi-user
  • Plus graphical desktop (GUI)

Similar to old runlevel 5.


3. How to Check Current Target

Use:

systemctl get-default

To see current active target:

systemctl list-units --type=target

To check what the system is currently running:

systemctl get-default

4. How to Change Target

Temporarily change target (without reboot)

Switch to multi-user:

sudo systemctl isolate multi-user.target

Switch to graphical:

sudo systemctl isolate graphical.target

Permanently set default target

sudo systemctl set-default multi-user.target

or

sudo systemctl set-default graphical.target

Very important for exam:

  • Know difference between isolate and set-default.

5. Logging In to the System

There are two main types:

1️⃣ Local Login

This means:

  • Logging directly from the system console.
  • Could be text login or GUI login.

In multi-user target:

  • You see a text login prompt.
  • Enter username.
  • Enter password.

Example:

localhost login:

2️⃣ Remote Login (SSH)

Very important for RHCSA.

Linux uses:

Entity reference:

OpenSSH

To connect to a remote system:

ssh username@server-ip

Example:

ssh student@192.168.1.10

You will be prompted for:

  • Password (unless key-based authentication is configured)

To log out:

exit

or

logout

6. Switching Users

In Linux, you can switch users without logging out.

Two main commands:

  • su
  • sudo

You must clearly understand the difference.


7. The su Command (Switch User)

su means substitute user.

Switch to another user:

su username

Example:

su student

It asks for:

  • The target user’s password

Switch to root user

su -

This is very important.

The - means:

  • Load the target user’s full environment.
  • Acts like a full login.

Without -, environment variables are not fully loaded.

For RHCSA:
You should use:

su -

to become root properly.


8. The sudo Command

sudo = superuser do

This allows a normal user to execute commands as root.

Example:

sudo dnf install httpd

It:

  • Asks for your password (not root password)
  • Checks if you are allowed in sudoers file

This is more secure than logging in directly as root.


Difference Between su and sudo

CommandPassword RequiredEnvironmentUsage
suTarget user passwordNot full (unless – used)Switch user
su –Target user passwordFull login shellBecome root
sudoYour passwordOnly runs one commandRun admin command

For exam:

  • Understand when to use each.
  • Know that sudo is preferred in enterprise environments.

9. Root Login

Root is the superuser.

Root can:

  • Modify system files
  • Install software
  • Manage users
  • Stop services

Best practice in IT environments:

  • Do NOT allow direct root SSH login.
  • Use sudo instead.

Root login via SSH can be controlled in:

/etc/ssh/sshd_config

Look for:

PermitRootLogin

10. Checking Logged-in Users

Important exam commands:

See who is logged in:

who

More detailed:

w

Current user:

whoami

User ID information:

id

11. Managing Sessions

Each login creates a session.

To see sessions:

loginctl

This is part of systemd.

It shows:

  • User sessions
  • Session ID
  • State

To terminate a session:

loginctl terminate-session ID

12. Console Switching (TTY)

Linux supports multiple virtual terminals.

Switch between consoles:

Ctrl + Alt + F1 to F6

Each opens a separate login prompt.

This is very important in troubleshooting situations in IT environments:

  • One console for admin work
  • Another for log monitoring
  • Another for service management

13. Important Exam Scenarios

For RHCSA, you may be required to:

βœ” Switch from normal user to root
βœ” Log in via SSH
βœ” Set system to multi-user target
βœ” Disable graphical interface
βœ” Identify current user
βœ” Check logged-in users
βœ” Exit safely from root

Practice these repeatedly.


14. Common Mistakes to Avoid

❌ Forgetting - with su
❌ Editing system files without root privileges
❌ Not exiting from root after work
❌ Confusing isolate and set-default
❌ Trying to run admin commands without sudo


15. Quick Practice Commands (Must Know)

systemctl get-default
systemctl set-default multi-user.target
systemctl isolate multi-user.target
ssh user@host
su -
sudo command
who
w
whoami
id
loginctl
exit

Final Exam Tips

For RHCSA:

  • Practice logging in and switching users many times.
  • Understand difference between multi-user and graphical target.
  • Know how to become root properly.
  • Be comfortable working in text-only mode.
  • Practice SSH connections.

This topic is foundational.
If you master this, you will be comfortable working in real Red Hat Enterprise Linux environments.

Buy Me a Coffee