su: Authentication failure
su: Permission denied
auth required pam_wheel.so group=root
This account is currently not available.
[@computer ~]# su --login stuart Last login: Tue Oct 21 17:02:29 CEST 2025 on pts/0 [@computer ~]# whoami root
stuart:x:1000:1000:Stuart,,,:/home/stuart:/bin/false
public, but it's known by members of our team and is something pretty generic, definitely not good enough for production machines.
Password: rootPassword:is the prompt output by su,rootis the result of whoami
Password: same prompt again root same result again
root
login=''; password='password'; salt=$(awk -F'$' -v login="$login" '$0 ~ login { print $3 }' /etc/shadow) passwordHash=$(openssl passwd -6 -salt "$salt" "$password") grep -c "$passwordHash" /etc/shadow
| Flag | Usage |
|---|---|
| - -l --login | Make the shell a login shell :
|
| -c command --command=command | Pass the command command to the shell. |
| -s shell --shell=shell | Invoke the shell shell |
su bob -c whoami bob as expected su bob -c whoami; echo $HOME bob as above /root the echo came once the su was over, then this is no surprise su bob -c "whoami; echo $HOME" bob this is still part of the su -c , so no surprise /root thanks to the",$HOMEis substituted with its current value, then the whole string is passed to su -c (details) su bob -c 'whoami; echo $HOME' bob no change /home/bob thanks to the', the whole expression is sent as-is to su -c (no substitution), then executed as bob value=42; su bob -c "echo $HOME [$value]"; su bob -c 'echo $HOME [$value]' /root [42] this is just to emphasize /home/bob [] on the example above