ubuntu16 04伺服器遠端xfce桌面登入

2021-09-10 14:18:02 字數 3596 閱讀 9296

配置vnc

非root使用者

參考:

sudo apt-get install xrdp
sudo apt-get install xrdp vnc4server
sudo apt-get update

sudo apt-get install xfce4 xfce4-goodies

首先進入root賬戶,啟動vncserver。第一次啟動一般都需要輸入密碼,對於root使用者,密碼檔案將儲存在/root/.vnc/passwd下,對於sudo許可權的使用者,密碼檔案儲存在家目錄/.vnc/passwd。如果忘記密碼, 可以刪除這個檔案,再次執行vncserver設定密碼。

設定好密碼後,vncserver啟動,在埠5901啟動乙個預設的伺服器例項。5901埠被稱為顯示器埠,並通過vnc所提到的:1。 vnc可以在其他顯示器埠啟動多個例項,如:2,:3,等等。

當使用vnc伺服器時,請記住:x是指顯示器埠5900+x。

在.vnc資料夾中,還有乙個非常重要的指令碼: xstartup。這個指令碼可以設定vnc遠端桌面的基本選項。

開啟該指令碼,將原檔案注釋掉,新增下面兩行:

#!/bin/bash 

xrdb $home/.xresources

startxfce4 &

修改xstartup指令碼後,儲存退出。關閉當前vncserver例項:

vncserver -kill :1

之後再重新啟動,更新vncserver設定:

vncserver :1

接下來,我們將vnc伺服器設定為systemd服務。 這將使其可以像任何其他systemd服務一樣根據需要啟動,停止和重新啟動。

首先,建立/etc/systemd/system/[email protected]

sudo gedit /etc/systemd/system/[email protected]
將以下內容複製並貼上到其中。 一定要改變pidfile的值使用者的價值和使用者名稱,以配合您的使用者名稱。

/etc/systemd/system/[email protected] 

[unit]

description=start tightvnc server at startup

after=syslog.target network.target

[service]

type=forking

user=dell

pamname=login

pidfile=/home/dell/.vnc/%h:%i.pid

execstartpre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1

execstart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i

execstop=/usr/bin/vncserver -kill :%i

[install]

wantedby=multi-user.target

儲存並關閉檔案。

接下來,讓系統知道新的單元檔案。

sudo systemctl daemon-reload
啟用service:sudo systemctl enable [email protected]檢視vncserver狀態:sudo systemctl status vncserver@1如果它正確啟動,輸出應如下所示:

對於非root使用者登入伺服器的情況,應該首先將xfce4-session寫入該使用者資料夾的xsession檔案:/home/username/.xsession

echo "xfce4-session" >~/.xsession

之後繼續配置xfce4

sudo vi /etc/xrdp/startwm.sh
. /etc/x11/xsession前一行插入xfce4-session設定非root使用者的xstartup檔案如下:

#!/bin/sh

# uncomment the following two lines for normal desktop:

unset session_manager

unset dbus_session_bus_address

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $home/.xresources ] && xrdb $home/.xresources

xsetroot -solid grey

x-terminal-emulator -geometry 1920*1600 -ls -title "$vncdesktop desktop" &

# xfce4-session &

xfdesktop &

xfsettingsd &

xfce4-menu-plugin &

xfwm4 &

sudo service xrdp restart
非root使用者:

unbutu16.04配置xfce桌面:

ubuntu16 04遠端鏈結雲伺服器

1.首先在伺服器上安裝ssh的伺服器端。sudo aptitude install openssh server 2.啟動ssh server。etc init.d ssh restart 3.確認ssh server已經正常工作。netstat tlp tcp6 0 0 ssh listen 看到...

ubuntu16 04 伺服器允許遠端連線

ubuntu預設安裝了openssh client,openssh server需要手動安裝。檢視是否安裝了ssh服務 apt cache policy openssh client openssh server 離線安裝 提取碼 ev13 1.將4個檔案放在 home test資料夾中 test新...

Ubuntu 16 04伺服器 配置

1.修改使用者名稱 切換到root開啟如下兩個配置檔案 sudo vim etc passwd 把我想改的 這個使用者名稱改為 way 了,儲存並退出 sudo vim etc shadow 同樣把 改為 way 儲存並退出 重啟後名字就變成了way ubuntu 2.現在要修改計算機名稱 ubun...