Welcome to the Linux Foundation Forum!
Facing problem when logging in as "root"
chekkizhar
Posts: 182
in Slackware
Hai,
In slackware, even if I login as "root", the commands like "lsusb","ppp-go","startx" are not responding. If I give "su" then again tried with same commands means, its working.
Am facing this problem recently [ last one week]. Previously, it was straight away worked if I logged in as root. The things happening now are,
root#lsusb
root#su
root#lsusb
0
Comments
-
linustorvalds wrote:Hai,
In slackware, even if I login as "root", the commands like "lsusb","ppp-go","startx" are not responding. If I give "su" then again tried with same commands means, its working.
Am facing this problem recently [ last one week]. Previously, it was straight away worked if I logged in as root. The things happening now are,
root#lsusb
<nothing is coming. same for ppp-go and startx>
root#su
root#lsusb
<it is listing the usb stuffs>
What does "nothing is coming" mean? is it frozen? it just ends with no output?
If, for any reason, the default output is broken you can try withlsusb > lsusb_output
And check if there is in fact some output on the file
Regards0 -
What does "nothing is coming" mean? is it frozen? it just ends with no output?
for "startx", it is trying to initiate the xserver, but it again come back to command line mode with error. [will post error, since now the system is not with me]
I guess, am not getting the root permission even I logging in as root. But, if i give the command "su", it is not prompting for password but thereafter the commands are working fine.0 -
It is pretty simple, due to some configuration change you made the PATH variable was not set, so your user shell does not know to look into /sbin, /bin, etc.. for commands.
Did you change .bashrc, /etc/profile or any related files prior to the issue?0 -
mfillpot wrote:so your user shell does not know to look into /sbin, /bin, etc.. for commands.
may be. But, I am logging as root. Meanwhile, after "su" command with out asking for password the commands are working.
after "su" , the shell can look into special binaries. But, why its not happening after I logged in as "root".
I will check more with whoami kind of commands, and report it here tonight. [system not with me currently ]
Did you change .bashrc, /etc/profile or any related files prior to the issue?
yes for my device driver programming I added my path in bash_profile. But, I did not remove any thing or changed anything in that file. Just added my path.0 -
I agree with mfillpot, and you could verify if that is the issue by specifying the absolute path to the binary as root. If it works, then thats what the issue is.
regards
Matt0 -
mpalmeruk wrote:I agree with mfillpot, and you could verify if that is the issue by specifying the absolute path to the binary as root. If it works, then thats what the issue is.
regards
Matt
I'll bet a beer that's the problemecho $PATH
Logged in as root and after "su". You'll see the difference.
Check /etc/profile and /etc/login.defs as well as /etc/bashrc or whatever files you might source on your login process.
Regards0 -
linustorvalds wrote:
yes for my device driver programming I added my path in bash_profile. But, I did not remove any thing or changed anything in that file. Just added my path.[/quote]
You hit the nail on the head. your modification in bash_profile would be the cause of the problems, the proper way to append an entry to the PATH variable would be:export PATH=$PATH:/new/path
please confirm that you typed it correctly, if you did not then your new path is the only one what is available to the user, you can confirm the PATH variable by explicitly calling the echo command with:/usr/bin/echo $PATH0 -
mfillpot wrote: the proper way to append an entry to the PATH variable would be:
export PATH=$PATH:/new/path
[/quote]
I would even go furtherexport PATH="$PATH":/new/path
Notice the "
Regards0 -
Logged in as root and after "su". You'll see the difference.
Check /etc/profile and /etc/login.defs as well as /etc/bashrc or whatever files you might source on your login process.
Regards
I checked in /etc/login.defs and in bash_profile before and after "su' command. NO difference in both files.
Before I give "su", if i give the absolute path, "/sbin/lsusb" , it is listing the usb details. simple lsusb gives "command not found"
Before and after "su" command the login.defs and bash_profile is same. And, the PATH variable I added some two months back[the moment i installed slackware]. It worked well so far. for the past few days only am facing.
But, thanks to Mathew and deop for the PATH variable adding method hint. I did not know till see your posts.0 -
I suggested to compare the $PATH variables under root and after "su", not the files (they will obviously be the same
).
Anyway, glad you could solve the issue
Regards0 -
what happened. For a long time offline mode.
marc wrote:I suggested to compare the $PATH variables under root and after "su", not the files (they will obviously be the same).
still my doubt is,
I am logging in as root and the shell supposed to load root's profile only, right ?
"su" is also doing the same, [ logging in as root and loading the user's profile variables ], right ? or any other added things are carried out?
thanks, Good day0 -
I would even go furtherexport PATH="$PATH":/new/path
Notice the "
Regards
I have one doubt.
$ symbol, itself a decoder . After that , adding " " is adding any further things? When we must use the " " ?
thanks0 -
linustorvalds wrote:what happened. For a long time offline mode.
marc wrote:I suggested to compare the $PATH variables under root and after "su", not the files (they will obviously be the same).
still my doubt is,
I am logging in as root and the shell supposed to load root's profile only, right ?
"su" is also doing the same, [ logging in as root and loading the user's profile variables ], right ? or any other added things are carried out?
thanks, Good day
Nope, it's not the same.
Depending on your distro's config you'll get different environments whenever you log in by root or scaling privileges by "su".0 -
linustorvalds wrote:
I have one doubt.
$ symbol, itself a decoder . After that , adding " " is adding any further things? When we must use the " " ?
thanks
$var is used to tell the shell to "expand" what's inside that variable.
One problem kicks in whenever blank spaces are in that variable. As bash (and most shells) works in "words"... how do we separate words? Bash uses blank spaces for that.... ( you can change that behaveour with the IFS variable though). What would happen if you have something like "/usr/my bin folder/" and you would like that to be in your path?PATH=/usr/my bin folder/
Bash would see:
"PATH=/usr/my" "bin" "folder/"
and try to run the "bin" with a "folder/" after setting the PATH variable to "/usr/my" parameter ala runningls /home
With the "" symbols we are telling bash that everything is a *word* therefore the "my bin folder" will be in our PATH
Have I explained myself? :S
Regards0 -
marc wrote:linustorvalds wrote:
I have one doubt.
$ symbol, itself a decoder . After that , adding " " is adding any further things? When we must use the " " ?
thanks
$var is used to tell the shell to "expand" what's inside that variable.
One problem kicks in whenever blank spaces are in that variable. As bash (and most shells) works in "words"... how do we separate words? Bash uses blank spaces for that.... ( you can change that behaveour with the IFS variable though). What would happen if you have something like "/usr/my bin folder/" and you would like that to be in your path?PATH=/usr/my bin folder/
Bash would see:
"PATH=/usr/my" "bin" "folder/"
and try to run the "bin" with a "folder/" after setting the PATH variable to "/usr/my" parameter ala runningls /home
With the "" symbols we are telling bash that everything is a *word* therefore the "my bin folder" will be in our PATH
Have I explained myself? :S
Regards
" PATH=/usr/my\\ bin\\ folder/ "
but, i agree, " " is a simple way to get rid of with the escape sequence character. Even, i tried the above "PATH=/usr/my\ bin\ folder/ " inside code section, which came as,PATH=/usr/my\ bin\ folder/
:ohmy:
need to use two escape sequence chars.0
Categories
- All Categories
- 51 LFX Mentorship
- 104 LFX Mentorship: Linux Kernel
- 576 Linux Foundation IT Professional Programs
- 304 Cloud Engineer IT Professional Program
- 125 Advanced Cloud Engineer IT Professional Program
- 53 DevOps Engineer IT Professional Program
- 61 Cloud Native Developer IT Professional Program
- 5 Express Training Courses
- 5 Express Courses - Discussion Forum
- 2K Training Courses
- 19 LFC110 Class Forum
- 7 LFC131 Class Forum
- 27 LFD102 Class Forum
- 157 LFD103 Class Forum
- 20 LFD121 Class Forum
- 1 LFD137 Class Forum
- 61 LFD201 Class Forum
- 1 LFD210 Class Forum
- LFD210-CN Class Forum
- 1 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum
- LFD237 Class Forum
- 23 LFD254 Class Forum
- 611 LFD259 Class Forum
- 105 LFD272 Class Forum
- 1 LFD272-JP クラス フォーラム
- 1 LFD273 Class Forum
- 2 LFS145 Class Forum
- 24 LFS200 Class Forum
- 739 LFS201 Class Forum
- 1 LFS201-JP クラス フォーラム
- 11 LFS203 Class Forum
- 75 LFS207 Class Forum
- 300 LFS211 Class Forum
- 54 LFS216 Class Forum
- 47 LFS241 Class Forum
- 41 LFS242 Class Forum
- 37 LFS243 Class Forum
- 11 LFS244 Class Forum
- 36 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 140 LFS253 Class Forum
- LFS254 Class Forum
- 1.1K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 93 LFS260 Class Forum
- 132 LFS261 Class Forum
- 33 LFS262 Class Forum
- 80 LFS263 Class Forum
- 15 LFS264 Class Forum
- 11 LFS266 Class Forum
- 18 LFS267 Class Forum
- 17 LFS268 Class Forum
- 23 LFS269 Class Forum
- 203 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- LFS281 Class Forum
- 235 LFW211 Class Forum
- 172 LFW212 Class Forum
- 7 SKF100 Class Forum
- SKF200 Class Forum
- 902 Hardware
- 219 Drivers
- 74 I/O Devices
- 44 Monitors
- 115 Multimedia
- 209 Networking
- 101 Printers & Scanners
- 85 Storage
- 763 Linux Distributions
- 88 Debian
- 66 Fedora
- 15 Linux Mint
- 13 Mageia
- 24 openSUSE
- 142 Red Hat Enterprise
- 33 Slackware
- 13 SUSE Enterprise
- 357 Ubuntu
- 479 Linux System Administration
- 41 Cloud Computing
- 70 Command Line/Scripting
- Github systems admin projects
- 95 Linux Security
- 78 Network Management
- 108 System Management
- 49 Web Management
- 68 Mobile Computing
- 23 Android
- 30 Development
- 1.2K New to Linux
- 1.1K Getting Started with Linux
- 537 Off Topic
- 131 Introductions
- 217 Small Talk
- 21 Study Material
- 826 Programming and Development
- 278 Kernel Development
- 514 Software Development
- 928 Software
- 260 Applications
- 184 Command Line
- 3 Compiling/Installing
- 76 Games
- 316 Installation
- 62 All In Program
- 62 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)