Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently in the process of configuring Open Grid Scheduler in FreeBSD. As part of this process I need to set the environmental variableSGE_ROOTas root.

To do this I have been experimenting with attempting to set this value through the root account's ~/.profile since this account has been configured to use the Bourne shell as it's default shell. I have exported SGE_ROOT as follows: export SGE_ROOT="/usr/local/sge"

However upon logging into the root shell with SGE_ROOT configured in it's ~/.profile it would seem that this method of setting the environment variable doesn't work since running the command env returns the following:


I do however notice that the PATH variable which I have also configured via root's ~/.profile to include the Open Grid Scheduler binaries would seem to have been successfully set.

I have also found that performing the same configuration in non-root accounts on the same machine succeeds in setting the environmental variable. In addition, exporting the value in the global /etc/profile seems to produce the same behaviour.

I am therefore wondering if perhaps there is a better way of setting this variable for the root account under the Bourne shell?

I understand that it would probably be easier to use tcsh as root's default shell, as this is typically how FreeBSD is configured. However I have thus far had to compile Open Grid Scheduler without support for tcsh due to issues with utmp.h no longer being available in FreeBSD.

share|improve this question
I think you first need to declare it and then you export it – natxo asenjo Jun 10 '14 at 13:13

I notice that you have SUDO environment variables, so I assume you are running this by using sudo. To test, I set my root user's shell to /bin/sh and added


export SGE_ROOT

to my /root/.profile

And I don't see the environment variable if I simply run "sudo sh", but I do have it if I run "sudo -i" or "sudo su -" so it seems like the issue has more to do with the way sudo is used than the shell.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.