Managing Xen With Xen-Tools, Xen-Shell, And Argo - Page 2
3 Xen-ShellThe xen-shell provides a special command-line interface that allows users to connect to the host system (dom0) via SSH and to control their own virtual Xen machine. This shell knows only commands which are needed to manage the virtual machine, so it cannot be abused for other tasks. It also allows the owner to reimage his virtual machine (if he messed up his current one), i.e., reset it to a pristine/new state. To allocate a virtual machine to a user, it must have the same name as the user. For example, if you have a user bob, then his virtual machine must also be named bob instead of vm03.example.com, etc. To demonstrate this, I first create a user bob and give him a password: useradd -d /home/bob -m -g users -s /bin/bash bob Now I create a virtual machine called bob: xen-create-image --hostname=bob --ip=192.168.0.105 --netmask=255.255.255.0 \ Then we boot up the guest domain to see if it works: xm create -c /etc/xen/bob.cfg and shut it down again: xm shutdown bob Next we install some prerequisites for xen-shell: apt-get install sudo libterm-readline-gnu-perl Afterwards, we install xen-shell like this: cd /tmp Now we must change bob's login shell from /bin/bash to /usr/bin/xen-login-shell: chsh -s /usr/bin/xen-login-shell bob (This step is optional if you are comfortable with the nano text editor: Next, I change Debian's default text editor to vi: update-alternatives --config editor <-- 3 (/usr/bin/nvi) ) Now we edit /etc/sudoers by using visudo. We have to allow bob to use the commands /usr/sbin/xm and /usr/bin/xen-create-image which require root privileges: visudo
This is necessary because otherwise bob won't be able to use the reimage function of the xen-shell. To use the reimage function, we also need a shell script called image.sh in bob's home dir /home/bob. This script must contain the commands to be executed to reset or create a new guest domain for bob. The contents is totally up to you. For example, it could look like this: vi /home/bob/image.sh
(You should use full paths in the script, and you must invoke the xen-create-image command with /usr/bin/sudo, otherwise bob isn't allowed to run xen-create-image.) We must make the script executable: chmod 755 /home/bob/image.sh Now bob can use his favourite SSH client (like PuTTY for Windows) and connect to dom0 (192.168.0.100). If all goes well, bob will see the xen-shell:
The following commands are available on the xen-shell:
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com
Red Hat Virtual Experience - a free virtual event. Dec. 9th





print: 
Recent comments
11 hours 43 min ago
17 hours 31 min ago
19 hours 22 min ago
21 hours 7 min ago
1 day 57 min ago
1 day 6 hours ago
1 day 6 hours ago
1 day 11 hours ago
1 day 16 hours ago
1 day 22 hours ago