预备工作

#开启防火墙端口
sudo ufw allow 3389
#安装ssh
sudo apt-get install openssh-server


一、windows直连Ubuntu16.04共享桌面



1、打开终端,安装xrdp,vncserver


sudo apt-get install xrdp vnc4server xbase-clients

2、安装desktop sharing(Ubuntu16.04默认已经安装),可以到应用商店下载。打开desktop sharing,设置如下



3、 安装安装dconf-editor,取消权限限制


sudo apt-get install dconf-editor

dconf-editor设置:org > gnome > desktop > remote-access,取消 “requlre-encryption”


4、 windows 远程登陆


cmd
mstsc
选择vnc-any
输入Ubuntu IP地址
端口 5900
桌面共享设定的密码

xrdp支持xfce4和mate桌面,不支持gnome和ubuntu桌面


准备工作:

在**/usr/share/applications**目录下打开“桌面共享”选项,桌面共享选项中首先要开启共享,关于是否允许其他用户控制,远程连接时是否需要本机确认,远程连接的密码等项目根据需要自己设定。如果需要从公网即外部网络访问此ubuntu计算机需要开启”自动配置UPnP路由器开放和转发端口项目”。一般建议如下图(可以按自己的要求设置):


很多情况下 xrdp 支持不了gnome,解决办法就是装个xface 界面。


××××××××××××××××××××××××××××

xrdp的配置文档在/etc/xrdp目录下的xrdp.ini和sesman.ini


xrdp.ini 关键部分在globals

[globals]
bitmap_cache=yes       #位图缓存
bitmap_compression=yes #位图压缩
port=3389              #监听端口
crypt_level=low        #加密程度(low为40位,high为128位,medium为双40位)
channel_code=1         #不知道是什么
max_bpp=24 XRDP最大连接数
[xrdp1]
name=sesman-Xvnc XRDP的连接模式
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1

sesman.ini

[Globals]
ListenAddress=127.0.0.1      #监听ip地址(默认即可)
ListenPort=3350              #监听端口(默认即可)
EnableUserWindowManager=1    #1为开启,可让用户自定义自己的启动脚本
UserWindowManager=startwm.sh
DefaultWindowManager=startwm.sh[Security]
AllowRootLogin=1              #允许root登陆
MaxLoginRetry=4               #最大重试次数
TerminalServerUsers=tSUSErs   #允许连接的用户组(如果不存在则默认全部用户允许连接)
TerminalServerAdmins=tsadmins #允许连接的超级用户(如果不存在则默认全部用户允许连接)[Sessions]
MaxSessions=10           #最大会话数KillDisconnected=0       #是否立即关闭断开的连接(如果为1,则断开连接后会自动注销)
IdleTimeLimit=0          #空闲会话时间限制(0为没有限制)
DisconnectedTimeLimit=0  #断开连接的存活时间(0为没有限制)[Logging]
LogFile=./sesman.log     #登陆日志文件
LogLevel=DEBUG           #登陆日志记录等级(级别分别为,core,error,warn,info,debug)
EnableSyslog=0           #是否开启日志
SyslogLevel=DEBUG        #系统日志记录等级

运行一段时间后,出现xrdp_mm_process_login_response: login failed

问题原因:远程桌面没有正确关闭,虽然在windows 系统关闭远程桌面连接,但是在里linux上的进程还在运行,导致连接数量达到上限,出现问题。
解决:通过设置sesman.in文件内的参数,解决。
Set session limits to avoid login failed error

[Sessions]
X11DisplayOffset=10
MaxSessions=100 #将最大会话限制改大
KillDisconnected=0
IdleTimeLimit=0
DisconnectedTimeLimit=0

将KillDisconnected=1;则每次断开连接时,linux都会关闭会话进程。不建议修改KillDisconnected,否则会自动关闭回话进程。最后重启xrdp即可。

#重启xrdp

sudo /etc/init.d/xrdp restart
或者
sudo service xrdp restart

××××××××××××××××××××××××××××

二、ubuntu16.04搭建xrdp远程xface桌面链接,xface桌面太难看且不好使用



1. 安装 XRDP及 vncserver


 sudo apt-get install tightvncserver xrdp sudo apt-get install vnc4server tightvncserver

** 2. 安装 Xfce桌面环境**


 sudo apt-get install xubuntu-desktop

** 3. 设置 xRDP**


 cd /home/youruser(youruser 是每个人自己的用户名)echo “xfce4-session” >~/.xsession

** 4. 设置配置文件**


#重启xrdp
sudo /etc/init.d/xrdp restart
或者
sudo service xrdp restart

此方法不需要额外修改配置文件

$  :  sudo gedit ~/.vnc/xstartup

三、ubuntu16.04搭建xrdp远程mate桌面链接




安装mate桌面


sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

安装tightvncserver


sudo apt-get install tightvncserver

安装xrdp


sudo apt-get install xrdp

配置xrdp


echo mate-session >~/.xsession
gedit /etc/xrdp/startwm.sh
#在./etc/X11/Xsession前插入
mate-session
#重启xrdp
sudo /etc/init.d/xrdp restart
或者
sudo service xrdp restart


要注意地方


一定要先装tightvncserver后装xrdp,不能够装vnc4server,已改为tightvncserver.



卸载xrdp和tightvncserver


sudo apt-get purge xrdp
sudo apt-get purge tightvncserver


四、Ubuntu 16.04: Remote connect to Unity with VNC/XRDP



1 Install tigervnc


Running the following script will install tigervnc

#!/bin/sh# Refresh repository.
sudo apt update -y# Install git and devscript.
sudo apt install -y git devscript# Remove vnc4server.
sudo apt remove -y vnc4server# Create working directory.
mkdir tigervnc
cd tigervnc# Download source code.
git clone https://github.com/TigerVNC/tigervnc
cd tigervnc/# Avoid compiler error.
git checkout ff872614b507d0aa8bfbd09ef41550390cfe658a# Prepare to build package.
ln -s contrib/packages/deb/ubuntu-xenial/debian
chmod a+x debian/rules
sudo apt install -y -o 'apt::install-recommends=true' \`dpkg-checkbuilddeps 2>&1 | \
sed -e 's/.*build dependencies://g' -e 's/([^)]*)//g'`# Build package.
fakeroot debian/rules binary
cd ..# Install package with resolving dependent package.
sudo dpkg -i *.deb || (sudo apt-get -f install -y ; sudo dpkg -i *.deb || exit 1)
cd ..

2 ${HOME}/.xsession


Create the following .xsession

$ cat ~/.xsession
/usr/lib/gnome-session/gnome-session-binary --session=ubuntu &
/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &
/usr/lib/unity-settings-daemon/unity-settings-daemon &for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; dobasename=`basename ${indicator}`dirname=`dirname ${indicator}`service=${dirname}/${basename}/${basename}-service${service} &
doneunity


3 Add gnome-control-center


With this article’s configuration, selecting “Sytem settings…” at the upper right will call gnome-control-center instead of unity-control-center. Add gnome-control-center which is symbolic link to unity-control-center.

$ sudo ln -s /usr/bin/unity-control-center /usr/bin/gnome-control-center

4 Run VNC server


Create password with vncpasswd

$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n

Run vncserver. Remote access port is 5900 + display nummber. A port of below example is 5901

$ vncserverNew 'ubuntu-16:1 (hiroom2)' desktop is ubuntu-16:1Starting applications specified in /home/hiroom2/.vnc/xstartup
Log file is /home/hiroom2/.vnc/ubuntu-16:1.log

5 Run XRDP server


$ sudo apt install -y xrdp


五、Ubuntu 16.04: Remote connect to GNOME Classic Desktop with VNC/XRDP



1 Preparation


Remove vnc4server and tightvncserver.
You can also switch vncserver to tigervncserver with update-alternatives command.

$ sudo apt remove -y vnc4server tightvncserver

Install git and devscripts

$ sudo apt install -y git and devscripts

Install packages for GNOME Classic Desktop

$ sudo apt install -y gnome-panel metacity

2 Install tigervncserver


tigervnc repository already has a devscripts files for Ubuntu 16.04.
I with that tigervnc ported to xenial-update.

Download tigervnc from repository. Checkout with hash which was used by this article.

$ mkdir tigervnc
$ cd tigervnc
$ git clone https://github.com/TigerVNC/tigervnc
$ cd tigervnc/
$ git checkout 044e2b87da7121ef6cbd59e88b101d7d8e282896 -b 044e2b87da7121ef6cbd59e88b101d7d8e282896

Move devscripts files to the top of directory with symbolic link

$ ln -s contrib/packages/deb/ubuntu-xenial/debian
Install packages for building tigervnc.
$ sudo apt install -y $(grep Build-Depends: debian/control | \
sed -e 's/Build-Depends://g' -e 's/([^\)]*)//g' -e 's/,//g')

Build tigervnc.

$ chmod a+x debian/rules
$ fakeroot debian/rules binary

Install deb files while installing depend package with running “apt -f install”.

$ cd ..
$ sudo dpkg -i *.deb || (sudo apt -f install -y; sudo dpkg -i *.deb)
$ cd ..

3 ${HOME}/.xsessionrc


This article will not use .vnc/.xstartup and .xsession, will use .xsessionrc which run program for GNOME Classic Desktop.

$ cat <<EOF > ~/.xsessionrc
gnome-panel &
metacity &
EOF
$ rm ~/.xsession

4 Run VNC server


Create password with vncpasswd

$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n

Run vncserver. Remote access port is 5900 + display nummber.
A port of below example is 5901.

$ vncserverNew 'ubuntu-16:1 (hiroom2)' desktop is ubuntu-16:1Starting applications specified in /home/hiroom2/.vnc/xstartup
Log file is /home/hiroom2/.vnc/ubuntu-16:1.log

5 Run XRDP server


Install and run xrdp

$ sudo apt install -y xrdp
$ sudo systemctl enable xrdp
$ sudo systemctl restart xrdp

六、ubuntu中通过remmina远程连接终端软件通过rdp协议连接win7


1. 在win7中开启允许远程访问
2. ubuntu中打开remmina软件,输入win7的ip,username,password就可以连接了

可能出现的问题


  1. 安装 XRDP及 vncserversudo apt-get install tightvncserver xrdp sudo apt-get install vnc4server tightvncserver2. 安装 Gnome桌面环境sudo apt-get install gnome-panel3. 设置 xRDPcd /home/youruser(youruser 是每个人自己的用户名)echo “gnome-session --session=ubuntu-2d" >.xsession4. 设置配置文件sudo /etc/init.d/xrdp restart

sudo apt-get install tightvncserver xrdp
sudo apt-get install vnc4server tightvncserver
echo “gnome-session --session=gnome-classic” >~/.xsession
sudo /etc/init.d/xrdp restart
配置后,结果会出现背景是灰色的情况,说明xrdp不支持GNOME,建议安装xface界面。


经常会出现 windows无法远程连接的情况,ssh 也是可以的。虽然IP都是正确的,这是因为你没有安装xrdp

打开终端:依次安装

sudo apt-get install tightvncserver xrdp
sudo apt-get install vnc4server tightvncserver

安装完毕以后,执行以下命令(该命令的作用是由于安装了 gnome桌面,ubuntu12.04中同时存在unity、GNOME多个桌面管理器,需要启动的时候指定一个,不然即使远程登录验证成功以后,也只是背景,其他什么也没有)

sudo /etc/init.d/xrdp restart

还有一种可能性是 you have to permit firewall to listen to connections on port 3389 that xrdp is working on. For this execute:

sudo ufw allow 3389

https://askubuntu.com/questions/234856/unable-to-do-remote-desktop-using-xrdp

若出现出现connecting to sesman ip 127.0.0.1 port 3350,而无其他问题显示**,则需要重启服务器**。


connecting to sesman ip 127.0.0.1 port 3350
sesman connect ok
seding login info to session manager, please wait…
xrdp_mm_process_login_response: login successful for display
started connecting
connecting to 127.0.0.1 5916
tcp connected
security level is 2 (1=none, 2=standard)
password failed
error - problem connecting

sudo apt-get install xrdp=0.6.1-2

https://askubuntu.com/questions/1108550/xrdp-failed-problem-connecting-when-package-was-auto-updated


七、Ubuntu 16.04: Remote connect to windows Desktop with rdesktop


rdesktop IP

八、SSH远程连接 Ubuntu



1. 安装 open ssh


sudo apt-get install openssh-server

2. 修改root密码


sudo passwd root

3. 辑配置文件,允许以 root 用户通过 ssh 登录


sudo vi /etc/ssh/sshd_config
找到:PermitRootLogin prohibit-password禁用
添加:PermitRootLogin yes
sudo service ssh restart

参考文献


putty+xming远程登录Ubuntu16.04图形界面

使用Windows 10远程控制Ubuntu 16.04

ubuntu16.04搭建xrdp远程mate桌面链接

Ubuntu 16.04: Remote connect to Unity with VNC/XRDP

windows远程连接ubuntu 16.04的unity桌面

Ubuntu 16.04: Remote connect to GNOME Classic Desktop with VNC/XRDP

XRDP – How To Remote Connect to Unity Desktop on Ubuntu 16.04

Linux下全能远程桌面高手Remmina使用说明

如何使用Ubuntu自带的远程连接

xrdp完美实现windows 远程桌面 ubuntu 16.04

解决Ubuntu 16.04 SSH 无法远程登录问题

学习ubuntu远程桌面(一):配置远程桌面

Windows通过远程桌面访问Ubuntu

使用xrdp实现windows 远程桌面 ubuntu linux

windows远程登录 ubuntu Linux 系统及互连共享桌面相关推荐

  1. 远程登录linux进程的状态_Linux实操篇 - 远程登录到Linux系统

    一.为什么要远程登录Linux系统 在我们日常开发中,具体情况如下: Linux服务器是项目组共享的; 正式上线的项目运行在公网上; 综上所述,我们需要通过工具远程登录到服务器进行项目管理; 二.远程 ...

  2. 使用Windows远程登录Ubuntu

    一.SSH登录     1.Ubuntu默认没有安装SSH ,可以在新得利软件安装程序里,搜索SSH,标记并安装:         或者使用命令:     sudo apt-get install o ...

  3. Windows使用ssh协议远程连接ubuntu linux子系统

    Windows使用ssh协议远程连接ubuntu linux子系统 一.Windows远程连接ubuntu linux子系统 二.开启ubuntu ssh服务 三.获取ubuntu子系统的ip地址 四 ...

  4. 如何远程登录连接Linux云服务器(电脑端/移动端)?

    目录 电脑端登录Linux云服务器 1.标准登录方式登录 2.远程登录软件登录 3.用SSH的方式登录 苹果电脑登录方式: Windows电脑登录方式: 4.VNC 登录 移动端登录Linux云服务器 ...

  5. 使用 xrdp 远程登录ubuntu出现黑屏或者花屏

    我是用的是Ubuntu21.10 arm64版本的 下载安装完xrdp后,windows远程登录Ubuntu出现黑屏 几经波折之后黑屏消失了,但是却出现了花屏 效果就像是很多桌面叠加在一起的那种感觉. ...

  6. linux怎么远程登录是图形界面,教你远程登录ubuntu图形界面

    教你远程登录ubuntu图形界面,1.获得X-Win32可以在www.starnet.com处下载X-Win32软件,下载前需要注册.2.X Window客户端和Wind Server u need ...

  7. 【githubshare】基于 C 语言编写的一款 2D 太空射击游戏,已在 Windows 10 和 Ubuntu Linux 16.04 系统上跑通测试

    基于 C 语言编写的一款 2D 太空射击游戏:space-shooter.c,已在 Windows 10 和 Ubuntu Linux 16.04 系统上跑通测试. GitHub:github.com ...

  8. uwin7下secureCRT SSH2远程登录Ubuntu系统问题解决

    在win7下想通过ssh远程登录Ubuntu系统总是出现如下错误: Key exchange failed. No compatible hostkey.******* 对于以上问题解决方法如下: u ...

  9. 大数据技术之_01_Linux学习_01_linux的入门+VM和linux的安装+linux的目录结构+远程登录到linux服务器+vi和vim编辑器+开机、重启和用户登录注销+用户管理+用户组管理

    大数据学习之_01_Linux学习_01 1 linux的入门 1.1 Linux的介绍 2 VM和linux的安装 2.1 安装vm和Centos 2.1.1 基本说明 2.1.2 CentOS安装 ...

最新文章

  1. 《代码敲不队》第五次作业:项目需求分析改进与系统设计
  2. 在WinForm中使用Web Services 来实现软件自动升级(转)
  3. web框架flask(12)——国际化和本地化
  4. 计算机网络 浏览器发送http请求的过程分析
  5. C++开发中的预处理器
  6. 移动游戏市场爆发背后的游戏引擎战局
  7. python列表总结
  8. 大话数据结构——查找
  9. 企业即时通讯规模将达7亿
  10. 软件导航html单页源码
  11. html css 深入理解float
  12. php 和风天气,【原创】彩云/和风天气插件
  13. java 线程状态_Java线程的状态
  14. 外研社php,外研社高中英语单词
  15. 步进电机怎么选型?步进电机驱动器选型要怎么选?
  16. 数据仓库之事实表和维度表
  17. java pdf 水印 加密_Java生成PDF 加密 水印
  18. VTK Learning Thirty - vtkPolyData to CGAL Surface_mesh
  19. HDU 5855-最大权闭合图(-最小割应用)
  20. LeetCode 第35题 搜索插入位置 做题记录

热门文章

  1. mysql双节点安装_快速安装及配置MySQL Replication双主节点集群--及改变数据保存目录...
  2. python模式选择符,Python设计模式之修饰器模式
  3. php获取随机图片,PHP 随机显示某张图片
  4. PAT_B_1011_Java(15分)
  5. oracle数据库的医院信息系统数据库升级方案,医院信息系统数据库从Oracle8i到10gR2升级的实现...
  6. 局域网屏幕共享软件 推荐_局域网共享软件,详细教您局域网共享软件如何使用...
  7. 数学--数论--广义欧拉降幂(模板)
  8. KMP算法中next数组的理解与算法的实现(java语言)
  9. C/C++中rand()函数产生随机数的用法
  10. TensorFlow调试常见问题(pycharm)