fix to irritating rsh(1) quirk
Neal Ziring
nz at wucs.UUCP
Thu Mar 28 12:04:54 AEST 1985
Description:
The rsh(1) command executes a shell command-sequence on a
remote host. It attempts to do execute the command while
pretending to `be' some user, usually the same user who
ran the command on his local host. However, the rsh-demon
on the remote host will not even attempt to execute the
specified command if the user has no home directory on
the remote host. In our environment this is intolerable,
because with several machines, some running VMS, a user may
not log onto all of them ever. This is especially true
of people who use applications packages that reside on a
single host.
Nevertheless, it is sometimes important for these users to
do an rsh on a remote Un*x host. In particular, the VMS
machines use rsh when sending graphics output to a Unix
printer.
Repeat-By:
Let's say you have two hosts, unixa and unixb. The user
bob has an account on each of them.
Do this command sequence, start as root on unixa.
a# rlogin unixb
---- stuff ----
b# cd ~bob/..
b# mv bob bob_directory_backup # bob now has no HOME on unixb
b# logout
a# su bob
bob_a% rsh unixb ls -al
rsh: No remote directory.
If the user has no home directory on the remote
host, he should still be allowed to execute commands there.
Fix:
The problem reported above is not really a bug, so this cannot
really be a fix, but I submit this patch(1) input for those of
you who may have a similar problem.
This is a quick fix to the rsh-demon. I am working on a more
comprehensive fix that will also allow your path to be sent
down to the remote host, but for now this does work. Note
that this change is transparent to users and programmers. This
fix also works for rshd's that have been converted to use the
general netd.
The source code for the rshd is in /src/etc/rshd.c
Note: the line numbers here will almost certainly be different
from the line numbers in your source code. Subtract about 15
to approach the correct line numbers.
The first chunk of diff is a local addition to the PATH
in the environment. The original default environment has a
rather scanty PATH. Fixing the path is not neccesary to fixing
the no-home-directory problem.
132c132,134
< {homedir, shell, "PATH=:/usr/ucb:/bin:/usr/bin", username, 0};
---
> {homedir, shell,
> "PATH=:/usr/ucb:/bin:/usr/new/bin:/usr/bin:/usr/local/bin:/etc",
> username, 0};
134a137,138
> #define DEFAULTDIR "/tmp" /* last resort directory for rshell */
>
232,235c236,240
< if (chdir(pwd->pw_dir) < 0) {
< error("No remote directory.\n");
< exit(1);
< }
---
> if (chdir(pwd->pw_dir) < 0)
> if (chdir(DEFAULTDIR) < 0) {
> error("No remote directory.\n");
> exit(1);
> }
--
--
========
...nz (ECL - we're here to provide superior computing)
Washington University Engineering Computer Laboratory
[ Remember: You can't spell `eCStacy' without `CS' ]
old style: ... ihnp4!wucs!nz
new style: nz at wucs.UUCP
More information about the Comp.unix.wizards
mailing list