In the starting rsh worked properly, but after making some changes it shows some error [changes are shown in the end of this question, see that], I am sharing the same.
Command
$ /usr/bin/rsh localhost ulimit -n
Output
poll: protocol failure in circuit setup
After facing this problem, I followed this link, but didn't get any help.
It works properly, but when I made some changes, from this link, then after that it shows the output as above. Now I revert all changes, but it shows the same output. Why?
These are the lines that I added in files, showing in left hand side, by seeing the above link.
/etc/pam.d/login: session required pam_limits.so
/etc/pam.d/sshd: session required pam_limits.so
/etc/pam.d/su: session required pam_limits.so
/etc/pam.d/system-auth: session required pam_limits.so
Here is the link of what I am trying to do.
Edit No. 1
strace -o log.txt rsh localhost pwd, some lines of output are as,
connect(3, {sa_family=AF_INET, sin_port=htons(514), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
bind(4, {sa_family=AF_INET, sin_port=htons(1022), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(4, 1) = 0
write(3, "1022\0", 5) = 5
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, -1) = 1 ([{fd=3, revents=POLLIN|POLLERR|POLLHUP}])
write(2, "poll: protocol failure in circui"..., 40) = 40
close(4) = 0
close(3) = 0
rt_sigprocmask(SIG_SETMASK, [], [URG], 8) = 0
exit_group(1)
Edit no. 2
Command - strace ~/rshd.trace in.rshd
Output
execve("/usr/sbin/in.rshd", ["in.rshd"], [/* 22 vars */]) = 0
brk(0) = 0x2b3054ec2000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b303671d000
uname({sys="Linux", node="jhamb.XXX.XXX", ...}) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b303671e000
arch_prctl(ARCH_SET_FS, 0x2b303671e6d0) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++