ssh tunnelingアプリケーションケース-AWS EC 2 vncデスクトップのサポート

2802 ワード

一般に、AWS EC 2であれ、阿里雲のクラウドホストであれ、linuxシステムはデフォルトでは、ssh登録方式のみを提供する。もしあなたがテクニカルコントロールであれば、グラフィックスインターフェースを振り回したいです。この中にはvnc serverのサポートが必要ではありません。また、vnc clientのようなvnc serverとの通信の問題もあります。二つの案があります 
1.手動で安全グループにより多くのポートを開放する
2.sshトンネルでvnc clientとserverの通信リンクをブリッジする
具体的には、以下のステップが必要です。
1.aws ec 2または阿里雲ホストを作成します。
2.WindowsクライアントにRealvncをインストールする
3.sshからc 2には、vncserverとその依存するコンポーネントをインストールするために、以下のコマンド(ubutuを例にして)を実行します。
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal xfce4 vnc4server
4.vncserverを起動し、vnc passwordを入力する
その後~/.vnc/xstartupファイルを編集し、以下の内容に置き換えます。
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
5.ポイントが来ました。sshのポートforwardingを開けます。
ssh -L 5902:localhost:5902 -i amazon.pem ubuntu@ec2–5290172228.compute-1.amazonaws.com
また、vncserverを起動します
vncserver -geometry 1340x750
注意したいのは、1340 x 750とは私のwindowsデスクトップの次のインチのことです。後に続く
6.Realvncを使ってlocal host:5902に接続し、上に設定されているpaswordを入力します。(there is a corelation between them(eg.display 1=vnc port 5901,601 and display 2=vnc port 5902 etc)
 
https://medium.com/@Arafat./graphcal-user-innterface-using-vnc-with-amazon-c 2-instancs-599 d 9 c 0695
 
転載先:https://www.cnblogs.com/kidsitcn/p/11120667.html