日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

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

發布時間:2023/12/13 linux 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 windows远程登录 ubuntu Linux 系统及互连共享桌面 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

預備工作

#開啟防火墻端口 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 系统及互连共享桌面的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。