-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux su Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to su on Linux, covering Arch Linux, CachyOS, and other distributions including switching users, becoming root, and user switching.
su (switch user) changes to another user account.
Uses:
- Switch users: Change to different user
- Become root: Switch to root account
- Test permissions: Test as different user
- System maintenance: Run commands as root
Note: Prefer sudo for security, but su is still useful.
Switch to root:
# Switch to root
su
# Enter root password
# Now you're root
# Exit
exitChange user:
# Switch to user
su username
# Enter user password
# Now you're that user
# Exit
exitPreserve environment:
# Switch with current environment
su - username
# Or
su -l username
# Full login shellMinimal environment:
# Switch without changing environment
su username
# Uses current environmentUse su when:
- Need root shell: Extended root session
- System maintenance: Multiple root commands
- Testing: Test as different user
Use sudo when:
- Single command: One command as root
- Security: Better audit trail
- Best practice: Recommended approach
Check password:
# Verify user exists
id username
# Check if user has password
sudo passwd username
# Try again
su usernameCheck access:
# Verify user in wheel group
groups username
# Check /etc/group
grep wheel /etc/groupThis guide covered su usage, user switching, and when to use su vs sudo for Arch Linux, CachyOS, and other distributions.
- sudo Guide - sudo usage
- User and Groups - User management
-
su Documentation:
man su
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.