ckl@uwbln.UUCP (Christoph Kuenkel) (12/20/88)
Is there any way to alter the default environment setting used when rsh (the bsd remote shell) executes commands? our rsh (bull sps9 with spix os) sets up an default environment HOME= <from passwd> LOGNAME= <from passwd> PATH=.:/bin:/usr/bin <hardwired> SHELL=/bin/sh <surprisingly not from passwd> TERM= <always empty> any hints? thanks, christoph -- # include <std/disclaimer.h> Christoph Kuenkel/UniWare GmbH Kantstr. 152, 1000 Berlin 12, West Germany ck@tub.BITNET ckl@uwbln {unido,tmpmbx,tub}!uwbln!ckl
dave@cs.wisc.edu (Dave Cohrs) (12/23/88)
> Is there any way to alter the default environment setting used when > rsh (the bsd remote shell) executes commands? Are you *sure* you're using the BSD rsh (don't forget about the rshd on the remote side), and not some Wollongong hacked up version that runs on a SysV machine? Seeing that LOGNAME in your environment leads me to wonder... The rsh I use between two real BSD systems gives me an environment with HOME, SHELL, PATH, and USER, and, because I use /bin/csh for a shell, runs my .cshrc, which sets whatever other environment variables I want. SysV's /bin/sh only runs your /etc/profile or your own .profile when you log in, and a remote shell is not the same thing as logging in. I guess if the remote machine is not a real BSD machine, or your shell is csh, you can't easily change your environment. You can, of course rsh a command like (assume your remote shell is /bin/sh or ksh): rsh somemachine "FOO=$FOO command args" and set one or more remote envariables to be the same as they were on your local shell (assuming you had a envariable FOO in your local shell). The variations on this theme are endless. You can also: rsh somemachine ". .profile ; command args" There are no provisions in the rsh protocol to automatically copy your environment to the remote shell. dave cohrs -- Dave Cohrs +1 608 262-6617 UW-Madison Computer Sciences Department dave@cs.wisc.edu ...!{harvard,rutgers,ucbvax}!uwvax!dave
jcbst3@cisunx.UUCP (James C. Benz) (12/24/88)
In article <1276@uwbull.uwbln.UUCP> ckl@uwbln.UUCP (Christoph Kuenkel) writes: >Is there any way to alter the default environment setting used when >rsh (the bsd remote shell) executes commands? > >our rsh (bull sps9 with spix os) sets up an default environment > HUH? (cr,h,...)ackers anyone? Isn't rsh RESTRICTED shell? Anyway, why not just set these in .profile using standard UNIX syntax ala HOME=/usr/mydirectory;export HOME That is, if you have permissions on .profile. Or is YOUR UNIX *different* than mine (AT&T)?
debra@alice.UUCP (Paul De Bra) (12/25/88)
In article <14640@cisunx.UUCP> jcbst3@unix.cis.pittsburgh.edu (James C. Benz) writes: >In article <1276@uwbull.uwbln.UUCP> ckl@uwbln.UUCP (Christoph Kuenkel) writes: >>Is there any way to alter the default environment setting used when >>rsh (the bsd remote shell) executes commands? >> >>our rsh (bull sps9 with spix os) sets up an default environment >> >HUH? (cr,h,...)ackers anyone? Isn't rsh RESTRICTED shell? Anyway, >why not just set these in .profile using standard UNIX syntax ala >HOME=/usr/mydirectory;export HOME >That is, if you have permissions on .profile. >Or is YOUR UNIX *different* than mine (AT&T)? Way back in the old days before networking /bin/rsh was a "restricted" shell. Some more recent versions of Unix may still have the restricted shell for historic reasons. I don't know about System V, but BSD and 9Vr2 have abandoned the restricted shell in favor of a "remote" shell, also called rsh. (But at least on 9Vr2 it is not /bin/rsh but /usr/bin/rsh.) Paul. -- ------------------------------------------------------ |debra@research.att.com | uunet!research!debra | ------------------------------------------------------
heilpern@ibd.BRL.MIL (Mark A. Heilpern ) (12/27/88)
In article <14640@cisunx.UUCP> jcbst3@unix.cis.pittsburgh.edu (James C. Benz) writes: >In article <1276@uwbull.uwbln.UUCP> ckl@uwbln.UUCP (Christoph Kuenkel) writes: >>Is there any way to alter the default environment setting used when >>rsh (the bsd remote shell) executes commands? >> >>our rsh (bull sps9 with spix os) sets up an default environment >> >HUH? (cr,h,...)ackers anyone? Isn't rsh RESTRICTED shell? Anyway, >why not just set these in .profile using standard UNIX syntax ala >HOME=/usr/mydirectory;export HOME >That is, if you have permissions on .profile. >Or is YOUR UNIX *different* than mine (AT&T)? I have seen in the past (System V maybe) where rsh was a RESTRICTED shell, apparently very affective, but basically useless. (It is my feeling that if a user must be in a shell environment, if he is not trusted to be in a shell allowing freedom, he does NOT have to be in a shell environment.) Recently, however, (I am using bsd4.2/3) rsh is a 'remote' shell which allows you to access machines in a local network, similar to rlogin. ---- These are my opinions and you don't have to like them, nor does my employer. -- |\/| | | | _ |< / \_(_(_)\_/ \______
andrew@riddle.UUCP (Andrew Beattie) (12/28/88)
In article <1276@uwbull.uwbln.UUCP> ckl@uwbln.UUCP (Christoph Kuenkel) writes: >Is there any way to alter the default environment setting used when >rsh (the bsd remote shell) executes commands? > >our rsh (bull sps9 with spix os) sets up an default environment > > HOME= <from passwd> > LOGNAME= <from passwd> > PATH=.:/bin:/usr/bin <hardwired> > SHELL=/bin/sh <surprisingly not from passwd> > TERM= <always empty> > >any hints? DID YOU BSD PEOPLE HERE THAT ??? What Christoph is trying to say is that we want an /etc/rshrc and $HOME/.rshrc which is run every time we grab a remote shell so that we can set up our environment exactly as we want it. On our Xenix boxes with Excelan the remote shell has $SHELL set up from passwd so the fix is to use csh and set up the environment in $HOME/.cshrc (I think that is the right file, I would rather suffer the inconvenience of setting up my environment each time than have to use csh)
chris@mimsy.UUCP (Chris Torek) (12/31/88)
In article <955@riddle.UUCP> andrew@riddle.UUCP (Andrew Beattie) writes: >DID YOU BSD PEOPLE HERE THAT ??? > >... On our Xenix boxes with Excelan the remote shell has $SHELL set up >from passwd so the fix is to use csh and set up the environment in >$HOME/.cshrc .... Where do you think Excelan got the idea? 4BSD's `rsh' remote shell (not restricted shell) runs the login user's shell. If that shell is a `csh', it reads ~/.cshrc under the usual restrictions for `csh -c' commands. It *would* be nice to have an `rsh' that propagated the environment. I resort to an `sh' script that does this for $DISPLAY for X11. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
kyriazis@rpics (George Kyriazis) (01/01/89)
In article <15215@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: > >4BSD's `rsh' remote shell (not restricted shell) runs the login user's >shell. If that shell is a `csh', it reads ~/.cshrc under the usual >restrictions for `csh -c' commands. > then can you tell me why when I do 'rsh localhost ph' where ph is my alias for 'ps aux | head' it says 'ph: Command not found' ?? I set up my aliases in my .cshrc. Also when I do rsh localhost alias it doesn't show anything. If I do rsh localhost printenv it just shows 4 shell variabls and not the tons I usually have. Any ideas? George Kyriazis kyriazis@turing.cs.rpi.edu kyriazis@ss0.cicg.rpi.edu ------------------------------
mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) (01/03/89)
<49@rpi.edu>, by kyriazis@rpics (George Kyriazis):
+ In article <15215@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
+>
+>4BSD's `rsh' remote shell (not restricted shell) runs the login user's
+>shell. If that shell is a `csh', it reads ~/.cshrc under the usual
+>restrictions for `csh -c' commands.
+>
+
+ then can you tell me why when I do 'rsh localhost ph'
+ where ph is my alias for 'ps aux | head' it says 'ph: Command not found' ??
+ I set up my aliases in my .cshrc. Also when I do rsh localhost alias
+ it doesn't show anything. If I do rsh localhost printenv it just shows
+ 4 shell variabls and not the tons I usually have. Any ideas?
If you do "rsh localhost set" you will probably find that "term" and
"prompt" are not set. So it looks like an rsh command runs a csh that
doesn't think it's an interactive shell (sorta makes sense). Your
.cshrc probably contains tests for $prompt and/or $term being set.
Move the aliases, etc., that you want available to rsh commands outside
the test clause.
Disclaimer: I get this behavior on Ultrix 2.2 and SunOS 3.x; your
environment may differ.
Mike Khaw
--
internet: mkhaw@teknowledge.arpa
uucp: {uunet|sun|ucbvax|decwrl|ames|hplabs}!mkhaw%teknowledge.arpa
hardcopy: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303