OpenVZ Forum


Home » General » Support » what sripts runs when you vzctl into a ve?
what sripts runs when you vzctl into a ve? [message #709] Sat, 07 January 2006 05:33 Go to next message
vmvmvm is currently offline  vmvmvm
Messages: 51
Registered: January 2006
Member
Hi,

Is there a particular script that runs and sets the environment, etc. for the shell when you vzctl into a server.

I notice that when I'm in the hardware node I have my regular bash enviroment but when I vzctl enter into a ve it is all set to blank:

bash-3.00# env
TERM=screen
PWD=/
SHLVL=1
HOME=/
HISTFILE=/dev/null
_=/bin/env

Can I edit this to set a preferred set of vars?

Thanks!
Re: what sripts runs when you vzctl into a ve? [message #718 is a reply to message #709] Sat, 07 January 2006 13:16 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Below is the excerpt from vzctl sources, file src/enter.c. You can see that all environment variables and their values are hardcoded.

If you want your normal environment, you should ssh to your VPS as you would do with a normal remote server -- vzctl enter is designed to be used as a "last resort" or "quick and dirty way of accessing your VPS".

char *arg[] = {"bash",  "--login", "-i", NULL};
char *env[] = {"HOME=/", "HISTFILE=/dev/null",
               "PATH=/bin:/sbin:/usr/bin:/usr/sbin:", NULL, NULL};
...
if ((term = getenv("TERM")) != NULL) {
   snprintf(buf, sizeof(buf), "TERM=%s", term);
   env[2] = buf;
}


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: what sripts runs when you vzctl into a ve? [message #732 is a reply to message #709] Sun, 08 January 2006 05:46 Go to previous message
phpfreak is currently offline  phpfreak
Messages: 47
Registered: January 2006
Member
Just type:

su -

When you're at the bash prompt. Problem solved Smile


Previous Topic: CentOS Disk space usage (df command) output is empty
Next Topic: How to properly set memory limits
Goto Forum:
  


Current Time: Sat Apr 27 20:33:18 GMT 2024

Total time taken to generate the page: 0.02627 seconds