我在各个论坛上搜索了很多,大多数都表明解决方案是在防火墙中打开端口或重新启动服务xinetd
。尽管在某些情况下这可能是解决方案,但我认为问题是另一个问题,并且仍然有待解决。
我有 Red Hat 6,iptables
服务已关闭,并且我没有修改可执行文件rshd
/ rsh
。
最初,当我启动系统时,rsh 工作正常:
# rsh localhost pwd
/root
如果我只是重新启动服务“xinetd”,我会收到已知消息“轮询:电路设置中的协议失败”:
# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
# rsh localhost pwd
poll: protocol failure in circuit setup
我只能通过两种方式解决这个问题:重新启动系统或进入第 2 级。
# init 2; sleep 1; init 3
# rsh localhost pwd
/root
我想找到根本原因。这不是防火墙问题。
这是strace
失败时的输出:
(参见突出显示的段落)
套接字(PF_INET,SOCK_STREAM,IPPROTO_IP)= 3 绑定(3,{sa_family = AF_INET,sin_port = htons(1023),in_addr = inet_addr(“0.0.0.0”)},16)= 0 fcntl(3, F_SETOWN, 23277) = 0 连接(3,{sa_family = AF_INET,sin_port = htons(514),sin_addr = inet_addr(“127.0.0.1”)},16)= 0 套接字(PF_INET,SOCK_STREAM,IPPROTO_IP)= 4 绑定(4,{sa_family = AF_INET,sin_port = htons(1022),sin_addr = inet_addr(“0.0.0.0”)},16)= 0 听(4, 1) = 0 写(3, "1022\0", 5) = 5 轮询([{fd=3,事件=POLLIN},{fd=4,事件=POLLIN}],2,-1)= 1([{fd=3, revents=POLLIN|POLLERR|POLLHUP}]) 写(2,“轮询:电路中协议失败”...,40)= 40 关闭(4) = 0 关闭(3) = 0 rt_sigprocmask(SIG_SETMASK, [], [URG], 8) = 0 退出组(1)
这是strace
正常工作时的输出:
(参见突出显示的段落)
套接字(PF_INET,SOCK_STREAM,IPPROTO_IP)= 3 绑定(3,{sa_family = AF_INET,sin_port = htons(1023),in_addr = inet_addr(“0.0.0.0”)},16)= 0 fcntl(3, F_SETOWN, 24718) = 0 连接(3,{sa_family = AF_INET,sin_port = htons(514),sin_addr = inet_addr(“127.0.0.1”)},16)= 0 套接字(PF_INET,SOCK_STREAM,IPPROTO_IP)= 4 绑定(4,{sa_family = AF_INET,sin_port = htons(1022),sin_addr = inet_addr(“0.0.0.0”)},16)= 0 听(4, 1) = 0 写(3, "1022\0", 5) = 5 轮询([{fd=3,事件=POLLIN},{fd=4,事件=POLLIN}],2,-1)= 1([{fd=4, revents=POLLIN}]) 接受(4,{sa_family = AF_INET,sin_port = htons(1020),in_addr = inet_addr(“127.0.0.1”)},[16])= 5 关闭(4) = 0 writev(3, [{"root\0", 5}, {"root\0", 5}, {"pwd\0", 4}], 3) = 14 读(3, "\0", 1) = 1 rt_sigprocmask(SIG_SETMASK, [], [URG], 8) = 0 setuid(0) = 0 rt_sigprocmask(SIG_BLOCK, [INT QUIT TERM], [], 8) = 0 rt_sigaction(SIGINT, {SIG_IGN, [INT], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGINT, {0x2abd2db30080, [INT], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, {SIG_IGN, [INT], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_IGN, [退出], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGQUIT, {0x2abd2db30080, [退出], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, {SIG_IGN, [退出], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, 8) = 0 rt_sigaction(SIGTERM, {SIG_IGN, [术语], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTERM, {0x2abd2db30080, [术语], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, {SIG_IGN, [术语], SA_RESTORER|SA_RESTART, 0x2abd2e3c1920}, 8) = 0 克隆(child_stack = 0,标志= CLONE_CHILD_CLEARTID | CLONE_CHILD_SETTID | SIGCHLD,child_tidptr = 0x2abd2eb893b0)= 24721 ioctl(5, FIONBIO, [1]) = 0 ioctl(3, FIONBIO, [1]) = 0 rt_sigprocmask(SIG_SETMASK, [], [INT 退出术语], 8) = 0 select(6, [3 5], NULL, NULL, NULL) = 1 (在 [3] 中) 读取(3,“/根\n”,8192)= 6 写(1, "/root\n", 6) = 6 select(6, [3 5], NULL, NULL, NULL) = 1 (在 [3] 中) 读取(3,“”,8192)= 0 select(6, [5], NULL, NULL, NULL) = 1 (在 [5] 中) 读取(5,“”,8192)= 0 杀死(24721,SIGKILL)= 0 退出组(0)=?
预先感谢您的帮助。
此致,
奥克塔维奥