Subject: 3 Questions

From: Mark Phillips <[email-masked]>
Date: Sun, 16 Jun 1996 05:30:12 +1000

I have 3 problems I would appreciate help with.

1. How does TERM get set?  When bash is the login shell for a user, it
seems that TERM gets set to linux when logging in from the console.
But when I changed my shell to tcsh, TERM no longer gets set to linux
as it should.  Why?

P.S. Is there any advantage to using bash instead of tcsh?  Does bash
have all the features that tcsh has?

2. I use the following command:

# pppd -d -detach /dev/cua1 &

To establish my ppp link to uni.  However I have been finding that
often I get a message saying that this job is "done", even though the
ppp connection has not been broken at the other end.  I just run this
command again and the link is reestablished, but it is annoying the
way it just dies every now and then for no reason.  Why?

Also, why is there no "ppp-off" script included with the ppp package?

3. My machine name is "destiny", yet I cannot rlogin to my own
machine.  When I type "rlogin destiny" I get:

destiny.phillips.com.au: No route to host

I don't know why it doesn't work.  What follows is all the information
that I thought might be relevant.  I hope someone can help me.

My "hosts" file is:

127.0.0.1       localhost
192.1.1.1               destiny.phillips.com.au destiny

I have setup my resolv.conf for my uni ppp connection, namely:

domain          cc.flinders.edu.au
search          maths.flinders.edu.au cs.flinders.edu.au
stats.flinders.edu.au
nameserver      129.96.252.31
nameserver      129.96.252.46
nameserver      129.96.1.21

These nameservers are the ones at uni.

I would have thought though that doing "rlogin destiny" would use the
"lo" interface?

When I run route I get:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref Use
Iface
localhost       *               255.255.255.255 UH    0      0     1
lo
annex05.cc.flin *               255.255.255.255 UH    0      0     0
ppp0
default         annex05.cc.flin 0.0.0.0         UG    0      0     3
ppp0

(when not connected via ppp, I only get the first two lines).

When I run ifconfig I get:

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Bcast:127.255.255.255  Mask:255.0.0.0
          UP BROADCAST LOOPBACK RUNNING  MTU:3584  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0
          TX packets:1 errors:0 dropped:0 overruns:0

ppp0      Link encap:Point-Point Protocol
          inet addr:129.96.250.55  P-t-P:129.96.250.15
Mask:255.255.0.0
          UP POINTOPOINT RUNNING  MTU:552  Metric:1
          RX packets:2783 errors:0 dropped:0 overruns:0
          TX packets:4456 errors:0 dropped:0 overruns:0

Does anything here seem wrong?  I can't work out why it doesn't
work as I compared it with my slackware system (which does work) and
can't see any significant differences.

Thank's in advance for your help.

Mark Phillips.  ([email-masked])

---

From: "Jeffery S. Coy Jr." <[email-masked]>
Date: Sun, 16 Jun 1996 02:51:56 -0700 (MST)

On Sun, 16 Jun 1996, Mark Phillips wrote:

> 1. How does TERM get set?
>

it is set by login(1).

> have all the features that tcsh has?

well, being a LONG time tcsh user, no, bash can't do everything tcsh does.
tcsh can do command line spell checking, has a better (IMO) built in
``which'' (it recognizes aliases), amoung other things.

but bash will help prevent you from learning bad skills (auto-spell
correction only teaches you that you don't have to spell well).  and bash
is more standard.  i highly recommend working with bash rather than tcsh,
i switched for a variety of reasons, especially for shell programming.

Linus dislikes tcsh a great deal, and also urges not to use it, and there
is a rather good FAQ on the dangers of (t)csh programming posted
regularly to comp.unix.programmer

> Also, why is there no "ppp-off" script included with the ppp package?

good question.  and why isn't pppd setuid root?  if it's a security issue,
a ppp group would be in order.

jeff
---
Why Linux?  source code. POSIX. tcpip. job control. support from the authors.
drivers for most hardware.  because one terminal or process is never enough.
    forget the other O/Ss, i use Linux- the choice of a gnu generation.

---

From: Christian Hudon <[email-masked]>
Date: Sun, 16 Jun 1996 17:57:22 -0400 (EDT)

> a ppp group would be in order.

I'd say 'because it doesn't neeed to be' is a good justification.

If you need to have non-root users execute ppp as root, take a look at the
'sudo' or 'super' packages. They allow you to define commands that can be
executed as root by a set of users... without forcing your choice of 'this
should be setuid root' programs on all other Debian users.

  Christian

---

From: Richard Kettlewell <[email-masked]>
Date: Sun, 16 Jun 96 23:53 BST

>If you need to have non-root users execute ppp as root, take a look
>at the 'sudo' or 'super' packages. They allow you to define commands
>that can be executed as root by a set of users... without forcing
>your choice of 'this should be setuid root' programs on all other
>Debian users.

Personally I find that the diald package is an excellent way of
avoiding this whole issue.  However:

As someone pointed out last time this came up, when your machine is
acting as a PPP server you need to run the pppd as root from a dialin
account.  One way of doing this (with the commercial PPP with which I
am familiar) is to make the pppd setuid root and run it from a shell
script which is that user's login shell.

(I suppose you could run the pppd directly, but doing it from scripts
is more convenient as it allows you to pass arguments to the pppd and
set various options on a per-user basis.)

One could make the uid of the account zero to achieve this without
making pppd setuid, though I can imagine this making people jump up
and down about security - can anyone think of an attack on this?

- Richard

-- 
http://www.elmail.co.uk/staff/richard/
GCS d- s+:- a-- C++ ULVS+++$ P+++ L++ E++ W(++,--) N(++,+) o? K w---
O? M- V? PS(+,+++) PE Y+ PGP+ t- 5++ X+@ R tv--- b++>++++ DI+ D+ G e++
h r% y++

---

From: Guy Maor <[email-masked]>
Date: Sun, 16 Jun 1996 18:14:54 -0500 (CDT)

> 1. How does TERM get set?

TERM is set from the kernel in init/main.c to linux.  init, login, et
al, propagaate it.

>  When bash is the login shell for a user, it

Perhaps your .tcshrc or .cshrc is messing with it.

> have all the features that tcsh has?

Read "csh programming considered harmful".  Just do a web search and
you'll have many hits.

> # pppd -d -detach /dev/cua1 &

Use "ppd -d /dev/cua1" instead, and your program will go away.

> Also, why is there no "ppp-off" script included with the ppp package?

There is - /etc/ppp/ip-down

> I would have thought though that doing "rlogin destiny" would use the

Look at what you've told it destiny's address was.

Guy

---

From: "Jeffery S. Coy Jr." <[email-masked]>
Date: Sun, 16 Jun 1996 16:41:20 -0700 (MST)

> avoiding this whole issue.  However:

i've been using kerneld (and request-route) to do this for some time now,
so it really wasn't an issue.  i was merely asking a question (since pppd
installs itself setuid root when you build your own).

jeff
---

---

From: Mark Phillips <[email-masked]>
Date: Sun, 16 Jun 1996 19:51:56 +1000

Thanks for your help.

>Perhaps your .tcshrc or .cshrc is messing with it.

No - I checked, plus I even removed .cshrc and the problem remained.
The strange thing is that TERM is set okay for xterms, but not for
linux consoles.  Could there be a bug in tcsh?

>Use "ppd -d /dev/cua1" instead, and your program will go away.

"program" or do you mean "problem"?  My problem is that this process
keeps on terminating prematurely.  I get a message saying the job is
finished even though I haven't told it to finish and even though the
modem link hasn't been broken.  I thought that all the "-detach"
option did was to stop the pppd process from detaching itself from the
terminal I ran it from.  I don't understand why this would solve my
problem.

>There is - /etc/ppp/ip-down

But isn't this only executed after the link goes down?  How do I tell
the link that I want it to go down - that's what I thought ppp-off was
for?  Also, if I put things like "reset the modem" in "ip-down", won't
this happen even when pppd dies prematurely like I mention above (in
which case I want to restart pppd rather than resetting the modem.)

Thanks again for your help - I appreciate it.

---

From: Guy Maor <[email-masked]>
Date: Sun, 16 Jun 1996 19:31:42 -0500 (CDT)

> linux consoles.  Could there be a bug in tcsh?

Maybe - do this on a running tcsh whose pid is xxx:

cat /proc/xxx/environ | xargs -0n1 | grep '^TERM='

to see what tcsh was passed as the TERM.  It should be the same in the
actual shell.

> >Use "pppd -d /dev/cua1" instead, and your program will go away.

oops - I meant problem.

> for?

Read the manpage for ppp under the signals option.  Send it a SIGTERM
with for example "killall pppd".

>  Also, if I put things like "reset the modem" in "ip-down", won't

Use the persist option for this.

Guy

---

From: Greg Kirmayer <[email-masked]>
Date: Sun, 16 Jun 1996 22:46:15 -0400

}fy@k

---

From: Mark Phillips <[email-masked]>
Date: Mon, 17 Jun 1996 02:21:46 +1000

>to see what tcsh was passed as the TERM.  It should be the same in the

I did this - the environ file is empty!!!  What could be wrong?

>> >Use "pppd -d /dev/cua1" instead, and your program will go away.

Why will the problem go away - what's wrong with using the "-detach"
option?

Thanks,

---

From: Guy Maor <[email-masked]>
Date: Mon, 17 Jun 1996 18:11:16 -0500 (CDT)

> I did this - the environ file is empty!!!  What could be wrong?

I doubt the file was empty.  You can't view it with less or something
because it stats as zero size.  Just cat it.  Use the xargs line to format
it nicely.

> Why will the problem go away - what's wrong with using the "-detach"

It'll still have a controlling terminal.  If you're using a shell
without job control (sh), it'll be in the same process group as the shell.

Guy

---

From: Richard Kettlewell <[email-masked]>
Date: Tue, 18 Jun 96 01:22:23 +0100 (BST)

>If the user figures a way to change their shell, you're dead. 

Quite so.  Similarly if there's a way of running a shell under a uid
provided you know the appropriate password.  AFAICT su is safe against
this as long as pppd (or whatever script one uses) isn't in
/etc/shells.

I'd be very wary indeed of actually *trying* this!

- Richard

---

From: Mark Phillips <[email-masked]>
Date: Mon, 17 Jun 1996 19:55:41 +1000

>because it stats as zero size.  Just cat it.  Use the xargs line to format

It really is empty!!  I'll paste in what I did:

# pwd
/proc/3
# ls
/usr/bin/color-ls: exe: No such file or directory
/usr/bin/color-ls: root: No such file or directory
/usr/bin/color-ls: cwd: No such file or directory
cmdline  environ  fd/      mem      stat     status
cwd@     exe@     maps|    root@    statm
# cat /proc/3/environ | xargs -0n1 | grep '^TERM='
# cat environ
#

>without job control (sh), it'll be in the same process group as the shell.

But does this have anything to do with why the process regularly dies?
Surely having a controlling terminal doesn't do any harm?

Thank's for your help,

---

From: Guy Maor <[email-masked]>
Date: Tue, 18 Jun 1996 10:00:29 -0500 (CDT)

> # cat /proc/3/environ | xargs -0n1 | grep '^TERM='

Somehow I doubt the pid of your shell is 3.  Type 'echo $$'.  Use that
number as the pid.

> Surely having a controlling terminal doesn't do any harm?

I thought it was dying because of SIGHUPs or something when you exited
the shell.  If it's dying for some other reason, check
/var/adm/messages.  I think there's some option you can set in
/etc/ppp/options to make it very verbose?

Guy