歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> redhat linux下配置rsh和rcp

redhat linux下配置rsh和rcp

日期:2017/3/1 13:53:14   编辑:關於Linux
redhat linux下配置rsh和rcp 1首先確認機器是否安裝rsh包: [oracle@linux ~]$ rpm -aq |grep rsh rsh-0.17-25.4 rsh-server-0.17-25.4 如果沒有安裝以上兩個包,請找到相關軟件安裝(如果是LINUX,可以從安裝碟中找到) 安裝包: rpm -ivh rsh-0.17-5 (linux 操作系統) rpm -ivh rsh-server-0.17-5 (linux 操作系統) 2: 修改/etc/xinetd.d/rsh腳本文件 no [root@linux ~]# vi /etc/xinetd.d/rsh rsh 屬於xinetd服務,修改/etc/xinetd.d/rsh腳本文件文件中的選項 將disable 設置為no # default: on # description: The rshd server is the server for the rcmd(3) routine and, / # consequently, for the rsh(1) program. The server provides / # remote execution facilities with authentication based on / # privileged port numbers from trusted hosts. service shell { socket_type = stream wait = no user = root log_on_success += USERID log_on_failure += USERID server = /usr/sbin/in.rshd # disable = yes disable = no } 3.重啟rsh服務 [root@linux ~]# service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] 4. 檢查是否啟動: rsh server 監聽和TCP 是514。 [root@linux ~]# netstat -an |grep 514 tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN unix 3 [ ] STREAM CONNECTED 44514 5:配置rsh server 修改/etc/securetty文件: echo rsh >>/etc/securetty 如果打算用root作為rsh用戶的話: 先用root登錄到機器A中進行以下操作: [root@linux ~]# echo "192.168.7.10 root" >>.rhosts //允許192.168.0.10 以root訪問 [root@linux ~]# echo "192.168.7.15 root" >>.rhosts 重啟rsh server. .rhosts一般位於 rsh server服務器相對應賬號目錄下比如root(與.bash_profile在同一目錄) 查看是否配置成功: [root@linux ~]# more .rhosts 192.168.7.10 root 192.168.7.15 root 6:配置vi /etc/hosts,加入對方的IP和機器名(hostname)。機器名可以參考127.0.0.1一行。 [root@linux ~]# vi /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 linux localhost.localdomain localhost 192.168.7.15 linux #本機ip及機器名 192.168.7.10 hlht #遠程服務器ip及機器名 7:配置vi /etc/hosts.equiv [root@linux ~]# vi /etc/hosts.equiv 127.0.0.1 localhost 192.168.7.10 hlht 192.168.7.15 linux 8:到/etc/pam.d/目錄下,把rsh文件中的auth required pam_securetty.so一行用“#”封掉即可(注意修改紅色字體一行:加#) [root@hlht ~]# cd /etc/pam.d [root@hlht pam.d]# vi rsh #%PAM-1.0 # For root login to succeed here with pam_securetty, "rsh" must be # listed in /etc/securetty. auth required pam_nologin.so #auth required pam_securetty.so auth required pam_env.so auth required pam_rhosts_auth.so account required pam_stack.so service=system-auth session required pam_stack.so service=system-auth 9:重啟rsh server. [root@linux ~]# service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] 10:測試和注意的問題: 登錄到192.168.7.10機器進行測試 看是否能看到結果。如果看到 [oracle@linux ~]$ rsh -l oracle 192.168.7.10 ps -ef connect to address 192.168.7.10: Connection refused Trying krb4 rsh... connect to address 192.168.7.10: Connection refused trying normal rsh (/usr/bin/rsh) Permission denied. 這是由於權權限問題,一般是由於 .rhosts沒有配置正確。.rhosts一般位於 rsh server服務器相對應賬號目錄下比如root(與.bash_profile在同一目錄) 如果看到 [root@linux pam.d]# rsh -l root 192.168.7.10 env|grep PATH connect to address 192.168.7.10: Connection refused Trying krb4 rsh... connect to address 192.168.7.10: Connection refused trying normal rsh (/usr/bin/rsh) PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin 表示rsh配置成功,可以使用rcp進行遠程拷貝。 11.RCP 遠程目錄拷貝 [root@hlht run]# rcp -r source linux:/opt/oracle/yljs //linux為剛才配置的192.168.7.15服務器名 connect to address 192.168.7.15: Connection refused Trying krb4 rcp... connect to address 192.168.7.15: Connection refused trying normal rcp (/usr/bin/rcp) [root@hlht run]# root用戶可以操作;普通用戶好像不行;沒有配置好普通用戶的遠程拷貝。
Copyright © Linux教程網 All Rights Reserved