D
David Mathog
(This is Off Topic but hopefully somebody here can
suggest the correct person to contact to address this.)
I have a hacked up version of rsh based on inetutils-1.4.2 which accepts
a list of hosts and runs the same command on each of them
(sequentially). In other words, it does this in a loop:
rem = rcmd (&host, sp->s_port, pw->pw_name, user, args, &rfd2);
where the host part changes but the other parts don't. This is so
that I can do:
rsh host1,host2,host3 whatever
or
rsh -f list_of_hosts whatever
instead of
rsh host1 whatever
rsh host2 whatever
rsh host3 whatever
Now the odd part: this modified rsh works just fine for root but for any
other user the rcmd call works once (for the first host) and
then gives a
rcmd: socket: Permission denied
when it attempts a second rcmd call. This is true even if host in
the second rcmd is the same as it was in the first rcmd.
Yes, the modified rsh is suid root, otherwise it wouldn't
even do the first rcmd call.
I tried adding
shutstat=shutdown(rem, SHUT_RDWR);
so that the socket would be closed the second time around but it
made no difference.
Additionally, the exact same behavior is observed when rsh runs
on Mandrake 10.0 or Solaris 8. It seems to be intrinsic somehow
in rcmd, or maybe just the rcmd() used by gcc.
Thanks,
David Mathog
(e-mail address removed)
suggest the correct person to contact to address this.)
I have a hacked up version of rsh based on inetutils-1.4.2 which accepts
a list of hosts and runs the same command on each of them
(sequentially). In other words, it does this in a loop:
rem = rcmd (&host, sp->s_port, pw->pw_name, user, args, &rfd2);
where the host part changes but the other parts don't. This is so
that I can do:
rsh host1,host2,host3 whatever
or
rsh -f list_of_hosts whatever
instead of
rsh host1 whatever
rsh host2 whatever
rsh host3 whatever
Now the odd part: this modified rsh works just fine for root but for any
other user the rcmd call works once (for the first host) and
then gives a
rcmd: socket: Permission denied
when it attempts a second rcmd call. This is true even if host in
the second rcmd is the same as it was in the first rcmd.
Yes, the modified rsh is suid root, otherwise it wouldn't
even do the first rcmd call.
I tried adding
shutstat=shutdown(rem, SHUT_RDWR);
so that the socket would be closed the second time around but it
made no difference.
Additionally, the exact same behavior is observed when rsh runs
on Mandrake 10.0 or Solaris 8. It seems to be intrinsic somehow
in rcmd, or maybe just the rcmd() used by gcc.
Thanks,
David Mathog
(e-mail address removed)