CertGrid CertGrid
Hands-on Lab·Red Hat Certified System Administrator

User Switching and Login Shells

The objective is "log in and switch users in multi-user targets", and the one thing worth practising is that `su user` and `su - user` leave you with different environments. Both are run side by side here, along with the four places the system records logins.

Users and Groups Guide 21 of 67 Beginner

Written against the versions above. `sudo -i` is the modern equivalent of `su -` and is preferable: it is authorised by sudoers, logged, and needs your own password rather than the target account's. `su -` needs the target user's password, which is why root having no usable password does not prevent `sudo -i`.

Every command on this page runs on RHCSA-A01.
Server NameIP AddressOSRolesCPURAMHDD
RHCSA-A01192.168.0.31RHEL 10.0 (Coughlan)Practice node (graded) - spare /dev/sda2 Core4 GB50 GB + 15 GB

Before you start

  1. Who am I, and who else is here

  2. su versus su dash

  3. Confirming which kind of shell you got

  4. The sudo equivalents

  5. Where logins are recorded

  6. A session in detail

Official sources