免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1606 | 回复: 2
打印 上一主题 下一主题

[系统安装] Securing VNC with SSH [复制链接]

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-06-15 08:57 |只看该作者 |倒序浏览
本帖最后由 ulovko 于 2012-06-20 09:20 编辑

If you're new to Linux or Unix, you might prefer using a graphical user interface (GUI) over the command-line interface (CLI), and when remotely connecting you can use the remote desktop protocol and GUI-based Virtual Network Computing (VNC).

Some Linux distros come with a VNC server pre-installed and for others you'll probably find plenty of tutorials on how to get started, so we'll skip the basics and share some security tips. As a result, for this tutorial we assume you already have a VNC server installed and running on a Linux/Unix machine.

Securing VNC with SSH

While VNC implements some sort of encryption for the login process, it's not fully secure and the login password could be sniffed and cracked by people on the local network or Internet. Plus the actual VNC sessions aren't encrypted at all.

To fully secure your VNC sessions you can tunnel the traffic through a SSH connection to the server. To do so, you'll first want to set up an SSH server and open the SSH port 22 on the machine you're trying to remotely access. Then on the computer you're remotely connecting from you can set up a port forward in the SSH client.

Here's how you'd configure the port forward when using the PuTTY SSH client:

  • Enter your host name or IP of the SSH server and select the private key file like normal.
  • Next, navigate to Connection > SSH > Tunnels.
  • For the Source Port, enter the port that you want to use when connecting via VNC over SSH on the local machine. You probably want to use "5900" -- the default port used by clients -- which means you don't need to specify a port when connecting via the VNC client.
  • For the Designation Port, enter "localhost:" and the port for the VNC display/session you want to connect to, which is likely "5901" -- so in this case you'd enter "localhost:5901"
  • Click the Add button.
  • If you'd like to save the connection settings, navigate back to the Session settings and click the Save button.


Now you can connect to your server via SSH, and while connected you can open your VNC client and connect to "localhost." Once successful, you may want to consider closing the VNC port (probably 5901) on your Linux machine if you had previously connected directly via the Internet.

Changing the VNC Password
If you'd like to change your VNC server's password in Linux you can use the vncpasswd command, which is the same command that's run by the vncserver script the first time you start a VNC desktop. This command will change and/or store an obscured version of the password to the password file by default at HOME/.vnc/passwd.

Since it's not securely encrypted, keep in mind that anyone with access to the password file could convert it to plain text and reveal the password.

When you're ready to change the password, enter the following command in the Terminal, either on the machine directly or remotely using a SSH client like PuTTY:

vncpasswd
You'll be prompted twice to enter the new password, which should be between six and eight characters long. Then restart the VNC server by killing the VNC session/display:

vncserver -kill :1
Then you can start the VNC session or display again by entering:

vncserver
Eric Geier is a freelance tech writer. He's also the founder of NoWiresSecurity, which provides a cloud-based Wi-Fi security service for businesses, and On Spot Techs, which provides on-site computer services.

评分

参与人数 1可用积分 +2 收起 理由
chenyx + 2 感谢分享

查看全部评分

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2012-06-15 12:32 |只看该作者
不错,好东西啊。

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
3 [报告]
发表于 2012-06-15 15:34 |只看该作者
好东西,这个应该就是ssh的X forwarding吧.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP