rsh(d) aborts in stupid error
Neal Ziring
nz at wucs.UUCP
Thu Mar 28 03:57:20 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.
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.
This is silly! If the user has no home directory on the remote
host, he should still be allowed to execute commands there! Uux
certainly has no such restriction.
Fix:
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.
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.
Note: 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.bugs.4bsd.ucb-fixes
mailing list