OT: rcmd() fails on second call if not root

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)
 
K

Keith Thompson

David Mathog said:
(This is Off Topic but hopefully somebody here can
suggest the correct person to contact to address this.)

Try comp.unix.programmer, or one of the gnu.* groups, or check the
contact info in the inetutils distribution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top