Article 5DKPP How set PATH for root user in Debian.

How set PATH for root user in Debian.

by
gardenair
from LinuxQuestions.org on (#5DKPP)
hi,
In my Debian 10 laptop, I am facing a problem using fdisk command which is in /sbin. My path is

Code:test@debian:~$ su
Password:
root@debian:/home/test# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
root@debian:/home/test#I can't execute the command
Code:root@debian:/home/test# fdisk -l
bash: fdisk: command not foundIf I set my PATH to:
Code:root@debian:/home/test# PATH="/sbin:$PATH"then I get
Code:root@debian:/home/test# echo $PATH
/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
root@debian:/home/test#After that the fdisk -l command executes perfectly. The problem is that every time I reboot my laptop, I have to set the path again. I want to add it permanently.

There is a file /etc/login.defs, This setting is for root and for normal users(if I am correct). If I use the command, in the middle of the file there is a path. Can I edit it? if it the right file? if yes then where may I add my path?

root@debian:/home/test# vi /etc/login.defs

Code:#
# *REQUIRED* The default PATH settings, for superuser and normal users.
#
# (they are minimal, add the rest in the shell startup files)
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/gamesAnother plase is Code:.profile which is hidden
root@debian:/home/test# ls -al

Please guide me on which file may I choose to edit for permanent changes and what should I add inside it. I don't know shell scripting I just want to add the path in my root user (by switching su from normal user) so I may use fdisk or any other utility in /sbin.

Thanks in advance.latest?d=yIl2AUoC8zA latest?i=6EOGUZWVYqw:sOZNhZzts6s:F7zBnMy latest?i=6EOGUZWVYqw:sOZNhZzts6s:V_sGLiP latest?d=qj6IDK7rITs latest?i=6EOGUZWVYqw:sOZNhZzts6s:gIN9vFw6EOGUZWVYqw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments