Results 1 to 10 of 10
Hey guys:
I am having a bash_profile issue.
When I log in as JohnDoe, then issue the command "su root" I am suppose to have root privileges.
I probably do, ...
- 08-18-2009 #1
Bash profile
Hey guys:
I am having a bash_profile issue.
When I log in as JohnDoe, then issue the command "su root" I am suppose to have root privileges.
I probably do, however it seems I am still in the "bash profile" environment of JohnDoe.
So if I want to issue this command as root: chkconfig --list
It says: command not found
But if I log out completely, then log in as root, I can run that command.
What is the point of issuing "SU" if you're not able to run commands as root user?
- 08-18-2009 #2
What you describe above is exactly how su is supposed to work. If you want to inherit the environmental variables of the user you are switching to, then you need to use "su -" and not just "su" e.g. to switch to root and inherit the path and other environmental variables, you can do
To switch to user john and inherit their path and other environmental variablesCode:su -
Code:su - john
- 08-18-2009 #3
- 08-18-2009 #4
- 08-18-2009 #5
Is there any difference between $BASH and $SHELL? I get the same results. Is one deprecated but somehow is still supported for backward compatibility?
[root@linux01 ~]# echo $BASH
/bin/bash
[root@linux01 ~]# echo $SHELL
/bin/bash
- 08-18-2009 #6
I'm guessing that $BASH is just a short-circuited version of $SHELL (specific to bash obviously). $SHELL is more generic. You happen to be using bash so the two are the same but if you were to be using the korn, shell your $SHELL would be /usr/bin/ksh and you probably would not have a $BASH variable (at least I do not in my korn shell).
- 08-18-2009 #7
- 08-18-2009 #8
There are a bunch of different shells, of which bash is one. The Bourne again shell (bash) is a follow-on to the Bourne shell (sh). The korn shell is another. There's also the C shell or csh, and the Z shell zsh. The Wikipedia page on UNIX shells is a good place to start:
Unix shell - Wikipedia, the free encyclopedia
There's not too much of a difference between bash and ksh, so if you're a beginner, I would just stick with bash until you find a need to move to another. Most Linux systems default to the bash shell. Although not all UNIX systems do.
- 08-18-2009 #9
There are many different shells out there. Most Linux distros default to bash, but you can install ksh, pdksh, csh, tcsh, zsh (which is my favourite), fish etc. Search for "linux shells" and "unix shells" and you should be able to find articles that discuss the various shells.
- 08-18-2009 #10
Thanks guys, I get the jist of it now on shells.
Once I become more of a power user of linux, I will probably start to find which shell is best for me.


Reply With Quote
