---
title: "启用xhost"
author: "simonhoo"
date: "2012-07-01T22:52:39Z"
tags: []
categories: ["操作系统"]
slug: "xhost"
draft: false
lastmod: "2012-07-01T22:52:39Z"
id: 1573405
url: "https://simonhoo.iteye.com/blog/1573405"
---

实用技巧：在Linux下设置xhost方法步骤

第一步：用root登陆linux，启动vnc服务；

第二步：根据vnc起来的端口，设置export DISPLAY=localhost:1（1表示vnc在第一个tty上启动的），vnc的启动信息见附件1；

第三步：执行xhost +，并且提示“access control disabled, clients can connect from any host”才正确。

 

SecureCRT运行记录的日志：

```
[root@OCP ~]# vncserver

New 'OCP.COTTSOFT.COM:1 (root)' desktop is OCP.COTTSOFT.COM:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/OCP.COTTSOFT.COM:1.log

[root@OCP ~]# export DISPLAY=localhost:1
[root@OCP ~]# xhost +
access control disabled, clients can connect from any host
[root@OCP ~]# su - oracle
[oracle@OCP ~]$ xhost +
access control disabled, clients can connect from any host

```