天天看点

连接AWS EC2 Linux instance Ubuntu远程桌面

创建了AWS EC2 Linux instance Ubuntu,记录下通过本地Windows远程访问AWS Ubuntu桌面的方法。

1, 更新,升级和安装准备

​sudo apt-get update sudo apt-get upgrade​

​ 2,配置sshd_config允许密码访问

​sudo emacs /etc/ssh/sshd_config​

将 PasswordAuthentication 选项设置为yes

​# Change to no to disable tunnelled clear text passwords #PasswordAuthentication no PasswordAuthentication yes​

​ 3,重启SSH伺服让配置生效

​sudo /etc/init.d/ssh restart​

​ 4,为用户名ubuntu设置密码

​sudo –i passwd ubuntu su ubuntu​

​ 5,为Ubuntu Linux Instance安装桌面功能

大概需要十多分钟,

​export DEBIAN_FRONTEND=noninteractive sudo -E apt-get update sudo -E apt-get install -y ubuntu-desktop​

​ 6,安装XRDP和其它xfce4资源

​sudo apt-get install xfce4 xrdp sudo apt-get install xfce4 xfce4-goodies​

​ 7,设置xfce4为RDP连接的默认window manager

​echo xfce4-session > ~/.xsession​

​ 8,拷贝.xsession 到 /etc/skel 目录

这样新的用户名被创建的时候,xfce4 自动被设置为默认的 window manager

​sudo cp /home/ubuntu/.xsession /etc/skel​

​ 9,修改xrdp.ini配置文件

当进行远程连接时允许改变主机端口,在 [xrdp1]区

​port=-1​

改为:

​port=ask-1​

​ 10,重启xrdp

​sudo service xrdp restart​

​ 11,在本地Windows端进行连接

打开Remote Desktop Connection,

连接AWS EC2 Linux instance Ubuntu远程桌面

输入Public DNS,点连接,

连接AWS EC2 Linux instance Ubuntu远程桌面

在“Login to xrdp”界面输入sesman-Xvnc, ubuntu和先前设置的密码,端口设置为-1,点OK

连接AWS EC2 Linux instance Ubuntu远程桌面