After using the command su (without any option) on a Debian 12 server, a junior administrator tries to run several system utilities:
# ifconfig
bash: ifconfig: command not found
# reboot
bash: reboot: command not found
# echo $PATH
/usr/local/bin:/usr/bin:/bin
A quick check shows that /usr/sbin/ifconfig and /sbin/reboot are present on the filesystem. Which action will most quickly restore access to these commands for the current root session and prevent the PATH problem from recurring when switching users in the future?
Execute ldconfig to rebuild the shared-library cache used by binaries in /usr/sbin and /sbin.
Run chmod 755 /usr/sbin/ifconfig and chmod 755 /sbin/reboot to make the utilities executable.
Append /usr/local/sbin to PATH in /etc/profile and reload the file with source /etc/profile.
Exit the current shell and re-enter the root account with su - so the full login environment (including /usr/sbin and /sbin) is loaded.
Invoking su - (or the equivalent su --login or sudo -i) starts a login shell for the target user. Login shells read the same startup files that are processed at an actual login and therefore apply the PATH defined for root in /etc/login.defs (ENV_SUPATH) and other profile scripts. This adds /usr/sbin, /sbin, and often /usr/local/sbin to the beginning of the PATH, allowing root-only utilities such as ifconfig, reboot, and many others to be located without typing absolute paths.
Using chmod will not help because the binaries are already executable; ldconfig only refreshes shared-library links and caches, not PATH; and adding a directory like /usr/local/sbin to /etc/profile would not fix the immediate session and would still omit /sbin and /usr/sbin unless those were added explicitly. Therefore starting a proper login shell with su - is the correct and fastest fix.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why does `su -` load the full login environment?
Open an interactive chat with Bash
What is the purpose of `PATH` and why does it exclude certain directories by default?
Open an interactive chat with Bash
What is the difference between `su` and `su -` in Linux?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Troubleshooting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .