X11 Forwarding
Use X11 Forwarding in SSH Client
After the X server is installed in your operating system, you can connect to virtual machine with X11 forwarding enabled in your SSH Client
Linux SSH Client
- In Linux, SSH terminal supports X11 forwarding by default, so you don’t need to install anything. You can connect to your virtual machine by typing:
$ ssh -i <your private key> -X username@ip address
- After you connected to your virtual machine, you can type the below command to test whether X11 forwarding is working:
$ xclock
macOS SSH Client
- Once X11 forwarding is setup, you can test it using the following command:
ssh -i <your private key> -X username@ip address
- After you connected to your virtual machine, you can type the below command to test whether X11 forwarding is working:
$ xclock
Windows SSH Client
In Windows, you can use putty to connect to your virtual machine with X11 forwarding enabled.
-
Open Putty and fill in the
username
andIP address
of your virtual machine. -
Go to the
Connection
menu and click the+
in front ofSSH
to exapnd the list. SelectX11
in the drop-down list. Tick the boxX11 forwarding
. Typelocalhost:0
inX display location
. Then click theopen
button. -
After you connected to your virtual machine, you can type the below command to test whether X11 forwarding is working:
$ xclock