一、開啓ssh服務[1][2]
Step1:
輸入命令“ssh localhost”,檢查主機有沒有ssh服務功能。
出現ssh:ssh:connect to host localhost port 22: Connection refused ,則表明沒有安裝。
如果有ssh服務功能,出現以下界面:
Step2:
安裝ssh服務功能“sudo apt-get install openssh-server”。
Step3:
輸入命令“ps -e |grep ssh”測試ssh服務是否開啓,如未開啓輸入命令“sudo /etc/init.d/ssh start”。
開啓後出現以下界面:
注:
如果服務器是動態獲取的IP,則只能是同一局域網的主機才能連接服務器
如果服務器是靜態IP,則不存在上面的問題
二、ubuntu下建立新用戶[3]
(1)輸入命令“sudo adduser nsername” username根據自己的需要更改爲自己喜歡的名字
(2)如果需要讓此用戶有root權限,執行命令“ sudo vim /etc/sudoers”
修改文件如下:
# User privilege specification
root ALL=(ALL) ALL
username ALL=(ALL) ALL
保存退出,username用戶就擁有了root權限。
額外可能用到的操作:
查看用戶列表
輸入命令“cat /etc/passwd”。
刪除用戶
輸入命令“sudo userdel –r username”。
三、windows遠程連接服務器[4]
1、在windows系統中下載安裝openssh for windows
地址:https://www.mls-software.com/opensshd.html
確認在path中添加了openssh的路徑。
2、打開cmd命令窗口輸入命令
“ssh username@ip”或“ssh -l username ip”
如果不熟悉命令參數,輸入"ssh -h"
四、遠程登錄界面化顯示Ubuntu服務器[5]
- 在Windows系統中安裝VNC CONNECT
下載安裝VCN Viewer,地址:https://www.realvnc.com/en/connect/download/viewer/
- 在Ubuntu中安裝VNC
(1)終端輸入命令“sudo apt-get install xrdp vnc4server xbase-clients”。
(2)電腦應用中打開Desktop Sharing,如下圖
(3)安裝dconf-editor
在終端輸入:sudo apt-get install dconf-editor
安裝成功後繼續輸入指令:dconf-editor
(4)在打開的dconf editor界面中,選擇如下路徑:org > gnome > desktop > remote-access
主要將require-encryption和prompt-enabled取消勾選
- 在windows中連接ubuntu
(1)獲取Ubuntu的IP地址,在終端中輸入:ifconfig
(2)打開Windows中的vnc客戶端,輸入Ubuntu的ip地址後回車:
完成的界面現象:
參考: