Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Tex-Twil

macrumors 68030
Original poster
May 28, 2008
2,501
15
Berlin
Hi,
I have a .profile file for my user and it is sourced correctly when I ssh to my OSX (10.5) When I do

Code:
sudo su
to become root, the .profile file on the HOME dir (/var/root) is not sourced ...

I tried also with .bash_profile and .bashrc but it is never sourced. Any ideas ?

Thanks,
Tex
 
hmm, I've just realized that the root account doesn't use bash but sh as shell.

Code:
jan@me ~ $ echo $SHELL
/bin/bash
jan@me ~ $ sudo su
root@me ~ # echo $SHELL
/bin/sh
 
Hmm, possibly because you can't login as root therefore you can't create a login environment as root either?
Well I only have my "user"account on my OSX and I havent created anything else. I thought that OSX works in the same was as Ubuntu linux distributions i.e. there is no login for root and if we want to be root, we have to "sudo su".
 
Well I only have my "user"account on my OSX and I havent created anything else. I thought that OSX works in the same was as Ubuntu linux distributions i.e. there is no login for root and if we want to be root, we have to "sudo su".

By default, it does. If you open up Directory Utility, and go to the edit menu, you'll see an option called "Enable root user". The first time you click this, it will prompt you to make a root password. (Note: the "Enable root user" option will be disabled until you unlock the window, the same way you would a preference pane).

With this one, you'll also be able to directly log in as root through the GUI, by typing in the username "root" and the root password.
 
As a non-root admin you can also do this:

sudo passwd root
Enter your password
Create root password
Verify root password

After that, just: su - and that will load .profile from /var/root
 

Attachments

  • Picture 2.png
    Picture 2.png
    52.5 KB · Views: 561
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.