HostOnNet Blog

Access OpenVZ Virtual Machine from Node

Looking for Linux Server Admin or WordPress Expert? We can help.

To get List all of running OpenVZ Virtual machine, run

vzlist

Example

[root@server10 ~]# vzlist
      CTID      NPROC STATUS    IP_ADDR         HOSTNAME
       101         47 running   199.168.108.237 mon1.hostonnet.com
       108        157 running   199.168.108.236 jira.hostonnet.com
       103        258 running   199.168.108.235 bit.hostonnet.com
       104         51 running   199.168.108.238 bamboo.hostonnet.com
[root@server10 ~]# 

To connect to any of the Virtual machines, all you need to do is

vzctl enter CTID

Example

[root@server10 ~]# vzctl enter 103
entered into CT 103
root@bit:/# ll
total 88
drwxr-xr-x  23 root root  4096 Jul 14 06:17 ./
drwxr-xr-x  23 root root  4096 Jul 14 06:17 ../
drwx------   2 root root  4096 Nov 26  2016 .cpt_hardlink_dir_a920e4ddc233afddc9fb53d26c392319/
-rw-r--r--   1 root root     0 Jul 14 06:18 .vzfifo
drwxr-xr-x   2 root root  4096 Jun 18 22:55 bin/
drwxr-xr-x   2 root root  4096 Nov 26  2016 boot/
drwxr-xr-x   5 root root   640 Jul 14 06:17 dev/
drwxr-xr-x  90 root root  4096 Jul 14 06:17 etc/
drwxr-xr-x   2 root root  4096 Nov 26  2016 home/
drwxr-xr-x  12 root root  4096 Jun 18 22:55 lib/
drwxr-xr-x   2 root root  4096 Jun 18 22:55 lib64/
drwx------   2 root root 16384 Nov 26  2016 lost+found/
drwxr-xr-x   2 root root  4096 Nov 26  2016 media/
drwxr-xr-x   2 root root  4096 Nov 26  2016 mnt/
drwxr-xr-x   3 root root  4096 Jun 18 23:13 opt/
dr-xr-xr-x 271 root root     0 Jul 14 06:17 proc/
drwx------   6 root root  4096 Jun 19 08:53 root/
drwxr-xr-x  19 root root   620 Sep 15 00:00 run/
drwxr-xr-x   2 root root  4096 Jun 18 22:55 sbin/
drwxr-xr-x   2 root root  4096 Nov 26  2016 srv/
drwxr-xr-x   7 root root     0 Jul 14 06:17 sys/
drwxrwxrwt  10 root root  4096 Sep 15 07:55 tmp/
drwxr-xr-x  10 root root  4096 Nov 26  2016 usr/
drwxr-xr-x  13 root root  4096 Jun 18 23:14 var/
root@bit:/# 

Now you are inside the VM. You can run all commands or even change root password for direct SSH access.

See OpenVZ

Posted in Virtualization

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.