Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3063653
  • 博文数量: 144
  • 博客积分: 10056
  • 博客等级: 上将
  • 技术积分: 2603
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-13 14:20
个人简介

互通有无,共同提高。

文章分类

全部博文(144)

分类: 系统运维

2011-01-06 11:16:06

机房里有数台dell工作站,其中A机(假如IP地址为:10.52.19.200)有Landmark工区,可从其它数台机器同时登录到A机启动LM工作。(昨天机房有几台机器出现xhost问题,即从客户机登录到远程机后,启动LM时,总是将显示输出到远程机,后来在terminal窗口上看了man xhost以及上网找到了一篇文章,在远程机上用“xhost - 客户机IP”解决了问题。下面的几步也算是对以往登录操作的简化:
 
1. 在A机以LM用户(ow2003)登录系统,新开一个terminal窗口(默认即LM用户家目录),或从任意一个terminal窗口上输入cd后回车,即可回到LM用户家目录下,然后分别以各个客户机名(这里仅以客户机B为例,假如它的IP地址为10.52.19.188,就以188为名)创建文件:
 
touch 188
vi 188
添加三行并保存:
 
#! /bin/csh
setenv DISPLAY 10.52.19.188:0.0
startow
 
然后,chmod 555 188
 
2. 同样,在客户机B以LM用户(ow2003)登录系统,新开一个terminal窗口,创建文件:
 
touch 200
vi 200
添加两行并保存:
 
xhost + 10.52.19.200
rlogin -l ow2003 10.52.19.200
 
然后,chmod 555 200
 
这样,在B的terminal窗口输入200,回车,按提示输入终端类型v,可直接登录到A机上(为登录方便,可以修改shadow文件,将用户ow2003的登录密码去掉);在登录过去的同一窗口输入188,回车,即可启动LM开始工作了。
 
注意:从B机往A机登录前,要退出B机上的Landmark command menu(如果有的话);另外,从任一terminal窗口,进入超级用户,输入gdmsetup 回车,打开 Security标签,查看一下 Allow running XDMCP chooser from the login screen 前面的勾是否勾选了,如果没勾选,将其选上;一定不要勾选 Always disallow TCP connections to X server(disables all remote connections),然后再打开XDMCP标签,保证Enable XDMCP和Honour indirect requests前面的勾为选中状态(在A机和B机都要检查一下)。
 
如果是R5000(通常安装在RHEL5.X以上版本),则进行以下设置:

# gdmsetup

 Remote Login disable---改为Same as Local

 Security 取消Deny TCP connection to Xserver前面的勾

 # gdm-restart

RHEL6.X的系统,需编辑/etc/gdm/custom.conf,增加以下内容:
[security]
#允许用root用户进行远程连接
AllowRemoteRoot=true   
[xdmcp]
#启动远程连接服务支持
Enable=true
#服务端口
Port=177

 
Landmark用的是csh,所以上面用的是#! /bin/csh(用命令:which csh 可以查看当前用户所使用的csh路径)。在终端用命令 echo $shell 可以查看当前用户的默认shell。如果是unix系统(如solaris8)下的LM,通常是:
 
#! /usr/bin/csh
setenv DISPLAY IP:0.0
startow
 

(值得一提的是:由于安装系统时没有选上相应的组件,在A机上没有rlogin服务,即在/etc/xinetd.d下没有rlogin文件。于是,把linux系统安装盘放入光驱,点开System Settings--Add/Remove Applications--Add or Remove Packages,找到相应组件,安装即可。

总结一下,将以上操作告诉我们的解释员,以客户机B往服务器A登录为例,就4步(实际3步):
 
1、关闭B机上的LM command menu(如果有的话);
2、在B机上新开一个终端窗口,输入200,回车;
3、输入终端类型V,回车(通过编辑$OWHOME目录下的.lgctermlogin文件,可以省略这步。见下面注释);
4、输入188,回车,即可打开LM command menu,开始工作了。
 
注:此法推荐个人或一两个人用,如果是多人登录多台机器,此法容易造成混乱,不推荐使用,还是用常规方法登录为好。

========================================================

Linux/Unix Command: xhost
 
"Networking" on Linux

In contrast to the typical use of traditional "personal" computers, in Linux/Unix environments, working "on the network" has always been the norm, which explains the powerful networking features of Unix and Linux operating systems. You can easily connect to other computers and run graphical user interfaces over the network. In this article we describe a simple method to do your work on any computer on the network without leaving your seat.
The key command is: xhost - the server access control program for X. The xhost program is used to add and delete host (computer) names or user names to the list of machines and users that are allowed to make connections to the X server. This provides a rudimentary form of privacy control and security.

Overview: Let's call the computer you are sitting at the "local host" and the computer you want to connect to the "remote host". You first use xhost to specify which computer(s) you want to give permission to connect to (the X-server of) the local host. Then you connect to the remote host using telnet. Next you set the DISPLAY variable on the remote host. You want to set this DISPLAY variable to the local host. Now when you start up a program on the remote host, its GUI will show up on the local host (not on the remote host).

Example of a Typical Use

Assume the IP address of the local host is 128.100.2.16 and the IP address of the remote host is 17.200.10.5. Depending on the network you are on, you may also be able to use the computer names (domain names) instead of the IP addresses.

Step 1. On the local host

Type the following at the command line:

% xhost + 17.200.10.5
< press return >

Step 2. Log on to the remote host

% telnet 17.200.10.5

Step 3. On the remote host (through the telnet connection)

Instruct the remote host to display windows on the local host by typing:

% setenv DISPLAY 128.100.2.16:0.0

at the command line. (Instead of setenv you may have to use export on certain shells.)
< press return >

Step 4. Now you can run software from the remote host.

E.g.: when you type % xterm on the remote host, you should see an xterm window on the local host.

Step 5. After You Finish

You should remove the remote host from your access control list as follows. On the local host type:

% xhost - 17.200.10.5
< press return >

Quick Reference - xhost

◆ xhost + hostname: Adds hostname to X server access control list.

xhost - hostname: Removes hostname from X server access control list.

xhost + : Turns off acccess control (all remote hosts will have access to X server)

xhost - : Turns access control back on.

Important: Use the man command (% man) to see how a command is used on your particular computer.

===========================

If you always plan to display everything back to one host, you can set the DISPLAY variable in your .cshrc file on all the remote hosts you plan on logging.

setenv DISPLAY localhost:0.0

You can set up aliases in your .cshrc file for all the potential machines you plan on displaying X applications back from. Then no matter which hosts you might be logged in to, you will always be able to set the display.

alias setrocket      'setenv DISPLAY rocket:0.0'
alias setmoon        'setenv DISPLAY moon:0.0'
alias setpluto       'setenv DISPLAY pluto:0.0'

Execute a remote shell that displays back an xterm window. When any applications within that window are executed, it automatically displays back on the local host.

% rsh remotehost -n /usr/bin/X11/xterm -display $DISPLAY

按照上述说明,在远程机的.cshrc文件中设置本地机的DISPLAY别名,也可以得到简化操作的效果。通常用ssh服务,不用rsh。现在要试的是,怎样使用下面的命令才能让远程显示返回到本地(试了几次,显示总是返回不到本地。待问题解决后再给出说明)。

% ssh remotehost -n /usr/bin/X11/xterm -display $DISPLAY

 

(另见, [求助] 工作站之间登录时,如何自动设置terminal type 为 vt100    )--问题已解决。

 

注释:

即,编辑$OWHOME目录下的.lgctermlogin文件,找到并注释掉set INKEY=($<)的行,然后在其下面添加一行set INKEY=v保存退出。如:

#  set INKEY=($<)
#  set INKEY=($<)
   set INKEY=v

这时,运行 source .lgctermlogin,即可看见效果了,如:

wx02{owr5000}% source .lgctermlogin

Terminal type  (v)  VT100, ie. Wyse 85
               (b)  vt100 (BS erase)
Enter terminal type: 
** TERM set to vt100 **

wx02{owr5000}%

阅读(11150) | 评论(3) | 转发(1) |
给主人留下些什么吧!~~

2011-08-21 20:41:26

佩服的五体投地。

山定子2011-01-18 15:22:45

i4knowledge: 山定子老师你好,看了你的这个从工作站远程登录另一个工作站,感觉很受启发,但是还有点不大明白,你touch 的那个 188 ,还有200 ,应该放在哪个路径下?能不能.....
你好!
touch的文件188和200分别放在用ow2003登录后的A机和B机用户目录下,为的是方便操作。我在文章中重新作了说明,一看即明。程序代码没变,操作很简单。

i4knowledge2011-01-18 13:25:33

山定子老师你好,看了你的这个从工作站远程登录另一个工作站,感觉很受启发,但是还有点不大明白,你touch 的那个 188 ,还有200 ,应该放在哪个路径下?能不能再把这个程序代码写详细些~谢谢~