# Bash prompt and /etc/profile



## sKu.nK (Aug 10, 2002)

Hi All

I havent been using OS X long (10.1.5), but I have some experience with Linux.

Could someone please tell me where the bash startup scripts are stored on OS X.

For example on Linux you had the "universal" file located at /etc/profile for all users and then the personalised scripts in ~/.profile.

I can't seem to find these.

I am trying hard to change my $PATH and have managed to but when I quit the terminal and re-open it, it just reverts to it's previous setting?????

My other question is that when you SU to root does it actually log you into the system as root, because whenever I try running apps as root and then check ps - aux it says the process is being run as a normal user ?????

Also if I have SU to root and i type echo $PATH then it just returns the normal users path

My final question is probably through lack of understanding      re:SUDO command.
If I am logged in as normal user (Administrator rights) and SUDO ... then if I enter my root password it won't accept it, I have to enter my administrator passwd not root   again

Any help would be greatly appreciated.

I must say though I'm not wonderfully impressed by OS X yet.  I think it's PRETTY but there seem like there might be wuite a few things to sort out.
Does Linux run well on iMAC G3 600 256MB RAM ???????

Thanks


----------



## wyvern (Aug 10, 2002)

Bash does not come by default in OS X versions previous to 10.2 so there are no bash startup files. You can make them if you want: pico /etc/profile and put in the stuff you want and save it...

To set up your path to include something not in it already, put this in /etc/profile or ~/.profile : 
export PATH="stuffyouwantinyourpath"
like export PATH="/usr/bin:/usr:/sbin"
or something to that effect.

When you SU to root, it changes THAT TERMINAL to root. Not your whole user setup. 

Why should root's PATH be any different than a normal user's path?

sudo SHOULD ask you for YOUR password. Not the root password. That's how sudo works.


----------



## lethe (Aug 10, 2002)

i believe that if you 'su -' instead of just 'su', you get the environment proper to the user you are suing to, i.e. PATH and HOME and such.  if you just 'su' you only get UID of the user (in this case root)

if you want to run an app as root from the terminal, i assume you were doing this:  
# open TextEdit.app

or such.  open will run the app with the permissions of the user logged into the system.  to run an app with root permissions, try this:


```
# /Applications/TextEdit.app/Contents/MacOS/TextEdit &
```
and that will open the app as root.  i might be wrong about this, but it is my impression that there is no way to do the equivalent in linux/X?  if _user_ owns the x server, than a root x client won t open for me.  gives me permissions errors.

i think linux should run OK on an iMac.  give yellowdog a try.  or if you ve a little more experience, gentoo/ppc.  i run gentoo on my PC, but OSX on my mac.  myself, i love OSX.


----------



## gatorparrots (Aug 11, 2002)

Even though it is listed in */etc/shells*, bash is not included in the default install of OS X, allegedly due to licensing issues.

You can get an OS X version here:
http://www.apple.com/downloads/macosx/unix_apps_utilities/bashthegnubourneagainshell.html


----------



## sao (Aug 11, 2002)

You can also install Bash with Fink.

 Cheers...


----------



## davidbrit2 (Aug 11, 2002)

There's also the bashrc startup file. I think profile is only read from plain logins, e.g. from a telnet session or logging in with the >console trick. I might be wrong about that, but I think that's more or less how the two files are handled. Personally, I put all my bash customization into ~/.bashrc and that seems to do the trick.


----------



## wyvern (Aug 11, 2002)

.bashrc SHOULD work. But it doesn't, at least in Jag. I don't know why. .profile or /etc/profile seem to be more reliable... If you put your information in .bashrc it's not read when you open a new terminal window; it's only read when you then type "bash".


----------



## sKu.nK (Aug 11, 2002)

Thanks all for the great help.

I have now create a /etc/profile file and have edited it as required.

Everything seems to be OK with it now



Is my understanding correct in thinking that the /etc/preofile file is read by ALL users on the system and then all personalisation for each user goes into ~./bashrc???

Thanks all

PS I am toying with the idea of dual booting OS X with Yellow Dog Linux


----------



## sKu.nK (Aug 11, 2002)

Apologies for my poor grammar!!!


----------



## wyvern (Aug 11, 2002)

Close, not quite. The individual personalizations should go into ~/.profile ...


----------

