Solaris11.4配置远程桌面登录
一. 版本信息
1. 内核版本信息
root@solaris11:~# uname -a
SunOS solaris11 5.11 11.4.27.82.1 sun4v sparc sun4v
root@solaris11:~#
root@solaris11:~#
root@solaris11:~# cat /etc/release
Oracle Solaris 11.4 SPARC
Copyright (c) 1983, 2020, Oracle and/or its affiliates.
Assembled 04 November 2020
root@solaris11:~#
2. 硬件信息
solaris11@kalami>prtconf
System Configuration: Oracle Corporation sun4v
Memory size: 129280 Megabytes
System Peripherals (Software Nodes):
ORCL,SPARC-S7-2
scsi_vhci, instance #0
disk, instance #15
disk, instance #16
packages (driver not attached)
SUNW,builtin-drivers (driver not attached)
pci-prober (driver not attached)
deblocker (driver not attached)
disk-label (driver not attached)
terminal-emulator (driver not attached)
dropins (driver not attached)
SUNW,asr (driver not attached)
kbd-translator (driver not attached)
obp-tftp (driver not attached)
vdisk-helper-pkg (driver not attached)
vnet-helper-pkg (driver not attached)
zfs-file-system (driver not attached)
hsfs-file-system (driver not attached)
chosen (driver not attached)
openprom (driver not attached)
client-services (driver not attached)
options, instance #0
aliases (driver not attached)
memory (driver not attached)
virtual-memory (driver not attached)
iscsi-hba (driver not attached)
disk (driver not attached)
reboot-memory (driver not attached)
cpu (driver not attached)
cpu (driver not attached)
cpu (driver not attached)
二. Solaris远程桌面登录
1 . SSH远程登录
Solaris11.4
默认开启SSH
服务,用户在客户端节点上通过ssh
命令直接远程登录到Solaris11.4
服务器上。
【1】. Win CMD命令行方式
【A】. 终端界面
Windows
机器上,在CMD
命令行通过ssh
远程登录Solaris11
服务器(登录用户名为kalami
),操作过程如下:
C:\Users>
C:\Users>ssh kalami@192.168.11.130
The authenticity of host '192.168.11.130 (192.168.11.130)' can't be established.
ED25519 key fingerprint is SHA256:lJ6haUr7VPvIs8sIFfYqPtlnA04WSR9SLbqqwlP6G/A.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes ## 输入yes
Warning: Permanently added '192.168.11.130' (ED25519) to the list of known hosts.
Password: ## 输入kalami用户密码
Last login: Mon Sep 30 13:47:31 2024 from 192.168.31.43
Oracle Corporation SunOS 5.11 11.4 November 2020
xset: unable to open display ""
solaris11@kalami>
solaris11@kalami>uname -a
SunOS solaris11 5.11 11.4.27.82.1 sun4v sparc sun4v
solaris11@kalami>
此时,用户通过终端方式登录到了Solaris
服务器上。
【B】. 图形界面
如果打开Solaris
服务器上的图形界面(如netui
、dbui
等),需要重定向到客户机上。命令如下:
export DISPLAY=xxx.xxx.xxx.xxx:0.0
其中,xxx.xxx.xxx.xxx
为客户机器IP
地址。
示例:
C:\Users>
C:\Users>ssh kalami@192.168.11.130
The authenticity of host '192.168.11.130 (192.168.11.130)' can't be established.
ED25519 key fingerprint is SHA256:lJ6haUr7VPvIs8sIFfYqPtlnA04WSR9SLbqqwlP6G/A.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes ## 输入yes
Warning: Permanently added '192.168.11.130' (ED25519) to the list of known hosts.
Password: ## 输入kalami用户密码
Last login: Mon Sep 30 13:47:31 2024 from 192.168.31.43
Oracle Corporation SunOS 5.11 11.4 November 2020
xset: unable to open display ""
solaris11@kalami>
solaris11@kalami>uname -a
SunOS solaris11 5.11 11.4.27.82.1 sun4v sparc sun4v
solaris11@kalami>
solaris11@kalami>export DISPLAY=192.168.11.15:0.0 ## 图形界面重定向到客户机
solaris11@kalami>. ./setenv.ksh ## 设置环境变量
xset: bad font path element (#0), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax
solaris11@kalami>
solaris11@kalami>netui ## 运行QT界面程序
netui: cannot connect to X server 192.168.11.15:0.0 ## 缺少X server模块
solaris11@kalami>
单独通过CMD
ssh
重定向Solaris
图形界面时,由于X server
的原因,无法重定向显示图形界面!!!
【2】. MobaXterm工具方式
MobaXterm工具支持客户端X server
功能,可以将Solaris
服务器图形界面重定向到客户机。
【A】. 终端界面
打开MobaXterm工具,点击Session
创建会话,协议类型选择SSH
,输入远程服务器地址和远程登录用户名。
登录后,终端界面如下:
Keyboard-interactive authentication prompts from server:
End of keyboard-interactive prompts from server
┌────────────────────────────────────────────────────────────────────┐
│ • MobaXterm 12.2 • │
│ (SSH client, X-server and networking tools) │
│ │
│ ➤ SSH session to kalami@192.168.11.130 │
│ • SSH compression : ✔ │
│ • SSH-browser : ✔ │
│ • X11-forwarding : ✔ (remote display is forwarded through SSH) │
│ • DISPLAY : ✔ (automatically set on remote server) │
│ │
│ ➤ For more info, ctrl+click on help or visit our website │
└────────────────────────────────────────────────────────────────────┘
Last login: Mon Sep 30 14:56:35 2024 from 192.168.11.15
Oracle Corporation SunOS 5.11 11.4 November 2020
xset: bad font path element (#0), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax
solaris11@kalami>
solaris11@kalami>uname -r
5.11
solaris11@kalami>uname -a
SunOS solaris11 5.11 11.4.27.82.1 sun4v sparc sun4v
solaris11@kalami>
【B】. 图形界面
如果打开Solaris
服务器上的图形界面(如netui
、dbui
等),需要重定向到客户机上。命令如下:
export DISPLAY=xxx.xxx.xxx.xxx:0.0
其中,xxx.xxx.xxx.xxx
为客户机器IP
地址。
示例:
Keyboard-interactive authentication prompts from server:
End of keyboard-interactive prompts from server
┌────────────────────────────────────────────────────────────────────┐
│ • MobaXterm 12.2 • │
│ (SSH client, X-server and networking tools) │
│ │
│ ➤ SSH session to kalami@192.168.11.130 │
│ • SSH compression : ✔ │
│ • SSH-browser : ✔ │
│ • X11-forwarding : ✔ (remote display is forwarded through SSH) │
│ • DISPLAY : ✔ (automatically set on remote server) │
│ │
│ ➤ For more info, ctrl+click on help or visit our website │
└────────────────────────────────────────────────────────────────────┘
Last login: Mon Sep 30 14:56:35 2024 from 192.168.11.15
Oracle Corporation SunOS 5.11 11.4 November 2020
xset: bad font path element (#0), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax
solaris11@kalami>
solaris11@kalami>uname -r
5.11
solaris11@kalami>uname -a
SunOS solaris11 5.11 11.4.27.82.1 sun4v sparc sun4v
solaris11@kalami>
solaris11@kalami>export DISPLAY=192.168.11.15:0.0 ## 图形界面重定向到客户机
solaris11@kalami>. ./setenv.ksh ## 设置环境变量
xset: bad font path element (#0), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax
solaris11@kalami>netui ## 运行QT界面程序
点击【是】选项。
图形界面重定向接受提示,选择【是】选项。
图形界面显示成功。
【C】. 特殊声明
当MobaXterm工具运行时,可以通过Win
CMD
命令行方式ssh
远程登录到solaris
服务器,并重定向图形界面到客户机,此时,同样可以显示图形界面。关闭MobaXterm工具后,CMD
重定向图形界面失败!!!
示例:
C:\Users>
C:\Users>ssh kalami@192.168.11.130
The authenticity of host '192.168.11.130 (192.168.11.130)' can't be established.
ED25519 key fingerprint is SHA256:lJ6haUr7VPvIs8sIFfYqPtlnA04WSR9SLbqqwlP6G/A.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes ## 输入yes
Warning: Permanently added '192.168.11.130' (ED25519) to the list of known hosts.
Password: ## 输入kalami用户密码
Last login: Mon Sep 30 13:47:31 2024 from 192.168.31.43
Oracle Corporation SunOS 5.11 11.4 November 2020
xset: unable to open display ""
solaris11@kalami>
solaris11@kalami>uname -a
SunOS solaris11 5.11 11.4.27.82.1 sun4v sparc sun4v
solaris11@kalami>
solaris11@kalami>export DISPLAY=192.168.11.15:0.0 ## 图形界面重定向到客户机
solaris11@kalami>. ./setenv.ksh ## 设置环境变量
xset: bad font path element (#0), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax
solaris11@kalami>
solaris11@kalami>netui ## 运行QT界面程序
图形界面重定向接受提示,选择【是】选项。
图形界面显示成功。
2 . VNC远程登录
【1】. Solaris服务器VNC服务设置
-
Solaris11.4
下直接运行vncserver
(任一用户,root
用户或者普通用户均可)就能启动VNC
服务。 -
vncserver
执行时默认不添加参数,第一个启动的vncserver
监听5901
端口,再执行一个vncserver
时监听端口号加一,以此类推。如果指定监听端口,则通过"vncserver :10"
方式运行,vncserver
将监听5910
端口。 -
由于
Solaris
上的VNC
服务是进程而不是Service
服务,所以如果重启操作系统,则还需要将vncserver
进程启动起来。
【A】. 查看VNC服务
ps -ef | grep vnc
solaris11@kalami>
solaris11@kalami>ps -ef | grep vnc
kalami 5640 5293 0 16:27:58 pts/1 0:00 grep vnc
root 4318 1 0 14:04:36 ? 0:32 /usr/bin/Xvnc :1 -auth /tmp/ssh-xauth-TChZvd/xauthfile -desktop solaris11:1 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5901 -rfbwait 30000
solaris11@kalami>
vncserver
在运行,并且监听5901
端口。
【B】. 登录密码设置
vncserver
默认读取当前用户$HOME/.vnc/passwd
文件,里边保存着远程登录用户需要提供的密码。
solaris11@kalami>cd .vnc/
solaris11@kalami>ls
config solaris11:2.log solaris11:4.log solaris11:1.log solaris11:3.log solaris11:4.pid
solaris11:1.pid solaris11:3.pid passwd xstartup
solaris11@kalami>
如果需要重新设置远程登录密码,则将$HOME/.vnc/passwd
文件删除掉,重启vncserver
进程,按提示设置密码。
示例如下:
solaris11@kalami>cd .vnc/
solaris11@kalami>ls
config solaris11:2.log solaris11:4.log solaris11:1.log solaris11:3.log solaris11:4.pid
solaris11:1.pid solaris11:3.pid passwd xstartup
solaris11@kalami>
solaris11@kalami>rm passwd ## 删除既有密码文件
rm: passwd: override protection 600 (yes/no)? y
solaris11@kalami>
solaris11@kalami>
solaris11@kalami>vncserver ## 启动一个VNC服务
You will require a password to access your desktops.
Password: ## 设置远程登录验证密码
Verify: ## 确认远程登录验证密码
Would you like to enter a view-only password (y/n)? n ## 是否设置只浏览账户
xauth: (stdin):1: bad display name "solaris11:2" in "add" command
New 'solaris11:2 (kalami)' desktop is solaris11:2
Starting applications specified in /home/kalami/.vnc/xstartup
Log file is /home/kalami/.vnc/solaris11:2.log
solaris11@kalami>
【C】. 启动/关闭VNC服务
通过直接运行vncserver
方式启动多个VNC
服务。
关闭VNC
服务时,先通过ps
命令找出PID
,并kill
掉即可。
示例如下:
# 查看当前运行的VNC服务端
solaris11@kalami>ps -ef | grep vnc
kalami 5909 5293 0 16:48:39 pts/1 0:00 grep vnc
kalami 5797 1 0 16:44:05 pts/1 0:00 /usr/bin/Xvnc :2 -auth /tmp/ssh-xauth-wIG3oc/xauthfile -desktop solaris11:2 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5902 -rfbwait 30000
root 4318 1 0 14:04:36 ? 0:38 /usr/bin/Xvnc :1 -auth /tmp/ssh-xauth-TChZvd/xauthfile -desktop solaris11:1 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5901 -rfbwait 30000
solaris11@kalami>
## 结束PID为5797进程
solaris11@kalami>kill 5797
solaris11@kalami>
## 再次查看当前运行的VNC服务端
solaris11@kalami>ps -ef | grep vnc
kalami 5956 5293 0 16:49:06 pts/1 0:00 grep vnc
root 4318 1 0 14:04:36 ? 0:38 /usr/bin/Xvnc :1 -auth /tmp/ssh-xauth-TChZvd/xauthfile -desktop solaris11:1 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5901 -rfbwait 30000
solaris11@kalami>
## 重新运行另一个VNC服务端
solaris11@kalami>vncserver
xauth: (stdin):1: bad display name "solaris11:2" in "add" command
New 'solaris11:2 (kalami)' desktop is solaris11:2
Starting applications specified in /home/kalami/.vnc/xstartup
Log file is /home/kalami/.vnc/solaris11:2.log
solaris11@kalami>
【2】. VNC客户端远程登录
客户端可以用任一VNC
客户端工具均可。这里,我使用了MobaXterm工具提供的VNC
客户端远程登录Solaris
服务器。
【A】. Solaris服务器查看当前是否运行VNC服务进程
solaris
上先查看是否运行VNC
服务端。
solaris11@kalami>ps -ef | grep vnc
kalami 6302 5293 0 16:59:14 pts/1 0:00 grep vnc
kalami 6245 1 0 16:55:53 pts/1 0:00 /usr/bin/Xvnc :3 -auth /tmp/ssh-xauth-wIG3oc/xauthfile -desktop solaris11:3 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5903 -rfbwait 30000
kalami 5978 1 0 16:55:12 pts/1 0:00 /usr/bin/Xvnc :10 -auth /tmp/ssh-xauth-wIG3oc/xauthfile -desktop solaris11:10 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5910 -rfbwait 30000
kalami 6121 1 0 16:55:39 pts/1 0:01 /usr/bin/Xvnc :2 -auth /tmp/ssh-xauth-wIG3oc/xauthfile -desktop solaris11:2 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5902 -rfbwait 30000
root 4318 1 0 14:04:36 ? 0:38 /usr/bin/Xvnc :1 -auth /tmp/ssh-xauth-TChZvd/xauthfile -desktop solaris11:1 (kalami) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/kalami/.vnc/passwd -rfbport 5901 -rfbwait 30000
solaris11@kalami>
【B】. MobaXterm VNC登录远程机器
打开MobaXterm工具,点击【Session】按钮,选择【VNC】协议。
点击【OK】,输入用户密码即可。
输入登录用户名及其密码,远程登录SOLARIS
系统。
远程登录成功。