xhost access control disabled, clients can connect from any host

来源:互联网 发布:办公软件office教程 编辑:程序博客网 时间:2024/06/13 12:56
.设置xhost相关程序时,系统提示

xhost access control disabled, clients can connect from any host 

第一步:用root登陆linux,启动vnc服务;
第二步:根据vnc起来的端口,设置export DISPLAY=localhost:1(1表示vnc在第一个tty上启动的)
第三步:执行xhost +,并且提示“access control disabled, clients can connect from any host”才正确。

此时再切换到Oracle用户开始安装程序

 

启动

在Linux操作系统之间要是使用图形化界面连接操作,也会用到系统自带的vnc,下面就来配置一下vnc。

1 检查是否安装

rpm -q | grep vnc

如果没有可以通过系统盘来进行安装

rpm -ivh vnc-server-......rpm

2 指定端口启动服务

[root@hp4u ~]# vncserver :1

New 'hp4u:1 (root)' desktop is hp4u:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/hp4u:1.log

这个示例已经不是第一次执行了,当第一次执行的时候,会提示让你输入登录密码。

说明:

VNC给浏览器的端口是5800+N,给vncviewer的端口是5900+N,N是设置的display号。

例如,使用vncserver :1启动vnc服务,那么在使用vncviewer连接时,指定的端口号应该是5901,浏览器端口号5801。

3 修改登录配置

这一步只在第一次使用vnc时,需要配置。

[root@hp4u ~]# cd /root/.vnc ##这一目录在第一次执行vnc后,自动生成。

[root@hp4u .vnc]# ll
total 60
-rw-r--r-- 1 root root 1565 Sep 19 19:48 hp4u:1.log
-rw-r--r-- 1 root root 6 Sep 19 19:48 hp4u:1.pid
-rw-r--r-- 1 root root 2211 Sep 16 13:51 hp4u:2.log
-rw-r--r-- 1 root root 6 Sep 16 13:47 hp4u:2.pid
-rw-r--r-- 1 root root 1560 Sep 16 13:50 hp4u:3.log
-rw-r--r-- 1 root root 6 Sep 16 13:50 hp4u:3.pid
-rw-r--r-- 1 root root 1915 Sep 16 18:33 hp4u:4.log
-rw-r--r-- 1 root root 6 Sep 16 13:51 hp4u:4.pid
-rw-r--r-- 1 root root 1915 Sep 16 18:33 hp4u:5.log
-rw-r--r-- 1 root root 6 Sep 16 13:54 hp4u:5.pid
-rw-r--r-- 1 root root 8770 Sep 16 13:56 hp4u:6.log
-rw------- 1 root root 8 Sep 19 11:09 passwd
-rwxr-xr-x 1 root root 350 Sep 19 11:09 xstartup

[root@hp4u .vnc]# vi xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm & ###将这行注释掉
gnome-session& ###新添这一行


[root@hp4u .vnc]# vi /etc/sysconfig/vncservers

# VNCSERVERS="2:myusername"
VNCSERVERS="1:root" ###添加,使用root用户登录
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" ###添加,设置窗口大小
vnc服务

 

原创粉丝点击