Root .profile $PS prompts showing for all telnet connections from all users ?

From: Barry Tait (Barry.Tait@aggreko.co.uk)
Date: Fri Jan 06 2006 - 16:07:42 EST


All,

Problem: The root /.profile $PS1 and $PS2 prompts showing for all telnet
connections from all users

Possible cause: Following wrong method when restarting inetd (seems
unbelievable)

I would be grateful for any help possible with the following as it is holding
up a project -

I promise to post any solution or useful information provided.

I googled hard on this and made some progress, but I'm still a bit stuck.

The server I am working on is a V880 with Solaris 8 and recent patching.

My main problem is when -ANY- user logs-in to my Solaris 8 server over telnet,
the prompts

they see are those set in my -ROOT- /.profile and intended for use by root
user only.

I proved this is the source of the prompt info by changing the $PS1 and $PS2
(primary and

secondary shell prompt) variable values in my root .profile and bouncing inetd
then reconnecting

using telnet - The telnet users' prompts changed too. Using truss on the
inetd process (output

 below) I found that, when called, telnetd uses the $PS1 and $PS1 variables
from the root .profile.

I do not see this problem using any other remote connection utility like
rsh/rlogin/ftp (And although

I know these do not run telnetd, they are all started by inetd). I have
checked all other initialisation

files and these values are not set anywhere else other than root /.profile. I
changed the values in

 /.profile only and restarted inetd. The values of $PS1 & $PS2 changed for
all users connecting

over telnet to the new values thereafter. I believe my problem is related to
the fact that telnetd

and/or inetd is/are -started by root- user and in the course of starting one
or both source the -ROOT-

 /.profile.

>From below you can see the root /.profile variables being sourced during the
telnet connection process.

earth # grep -i PS /.profile

PS1="earth # "

 PS2="pluto > "

export PS1 PS2

earth #

earth # id

uid=2011(mappadm) [GID not important] _ Not root this
user was logged-in over telnet

earth #

earth # ksh

earth # for files in `ls`; do

pluto > <-- Secondary prompt

Following is the excerpt of output from the following command: $ truss -leaf
-p PID# [[[PID# of inted]]]

when I connected to the server running inetd (Server A) from another server
(B) using a telnet connection.

You can see the values set on the second last line of the excerpt. I changed
these back to their original

 value which is why they are different from those above.

22001/1: execve("/usr/sbin/in.telnetd", 0x0002C330, 0xFFBEFCC0) argc =
1

22001/1: argv: in.telnetd

22001/1: envp: EDITOR=vi HOME=/ HZ= LD_LIBRARY_PATH=:/usr/openwin/lib

22001/1: LOGNAME=root

22001/1:
MANPATH=/opt/CTEact/man:/opt/SUNWexplo/man:/opt/VRTS/man:/opt/

VRTSvmsa/man:/opt/VRTSvxvm/man::/usr/man:/usr/share/man

22001/1: OPENWINHOME=/usr/openwin

22001/1:
PATH=/opt/CTEact/bin:/opt/SUNWexplo/bin:/opt/SUNWvts/bin:/opt/

sun/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ope
nv/

bin:/usr/openv/volmgr/bin:/usr/openv/netbackup/bin:/usr/local/bin:/etc/vx/bin
:/o

pt/VRTSvmsa/bin

22001/1: PS1=root@[servername <mailto:PS1=root@[servername> ] #
PS2=root@[servername] <mailto:PS2=root@[servername]> >

22001/1: PWD=/etc/init.d SHELL=/usr/bin/ksh TERM=dtterm TZ=GB

I suspect that in the course of starting the telnet session, the .profile (if
it exists) or /etc/profile and any

other applicable initialisation file (.kshrc/.login/.cshrc/etc.) is being be
sourced for the user -after- the

root .profile & I know that if called, those files depend on user's default
shell (ksh in all cases herein).

I believe this means that I *could* resolve the issue by adding $PS values to
individual .profiles for each

user OR by removing the $PS variable values out of my root .profile. Neither
"work-around" solution

 would help me understand or if possible "correct" the problem.

The former above seems excessive and I'd prefer to avoid the latter as the
prompt is there for root

good reasons - Can anyone advise how I can deal with this problem without the
aforementioned

upheaval (Please read on before answering as there is more to this problem ...
)?

I tested another server using the following process and found that the above
problem was not consistent

on same O/S patch level but different server until I restarted inetd.:

No inetd restart - Problem not yet present despite /.profile

=============================================

Process: (1) I set the root $PS1 and $PS1 variables in root .profile on Server
A and (2) I make a telnet

connection from Server B to Server A.

Expected: I would expect the following result: $PS1 & PS2 values show as
telnet prompt for connected

user command/shell.

Actual:The prompts were normal for non-root telnet user - they -DID NOT- see
the /.profile prompts

(see below):

$ su -

[snip]

root@gla1c102 # grep -i PS /.profile

PS1="root@`uname -n` # "

PS2="root@`uname -n` > "

export PS1 PS2

$

root@gla1c102 # ps -ef | egrep 'telnetd|inetd' _Daemons started root user
as normal

    root 1296 1 0 Oct 25 ? 1:01 /usr/sbin/inetd -s

    root 4554 1296 0 22:19:27 ? 0:00 in.telnetd

    root 4786 4734 0 22:21:14 pts/3 0:00 egrep telnetd|inetd

root@gla1c102 # exit _Back to non-root
user

Prompts are normal/correct for this user

$ id

uid=101(mvxconf) {GID NOT IMPORTANT}

$ cd ~

$ grep PS *

$ env | grep PS

$

I then restarted inetd as (to be honest) I had forgotten to do this above and
the problem

appeared on the second server! I have not manually restarted inetd for a very
long time and

have tried both of the following methods on both servers *AS ROOT* user but I
can't get back to

the original and correct prompts on either server, but I am concerned that the
method of restarting

inetd I am adopting might be the *ROOT CAUSE* of the main problem above:

With inetd restart - Problem appears

==============================

earth # pwd
/etc/init.d
earth # ./inetsvc stop
earth # ps -ef | grep -i inetd
earth # ./inetsvc start
Setting netmask of eri0 to 255.255.255.0
Setting default IPv4 interface for multicast: add net 224.0/4: gateway
aggrekodev1
earth #

earth # kill -HUP [inetd PID]

Did not die so:

earth # kill -9 [inetd PID] ; /usr/sbin/inetd -s

earth #

Thanks in advance for any help you can give with this problem.

Barry Tait
Systems Administrator
Aggreko (UK) Ltd
Email: barry.tait@aggreko.co.uk <mailto:barry.tait@aggreko.co.uk>

Visit us at http://www.aggreko.com

Confidentiality Notice: This communication and any accompanying attachments
contain confidential information intended for a specific individual and
purpose. This communication is private and protected by law. If you are not
the intended recipient, you are hereby respectfully notified that any
disclosures, copying, forwarding or distribution, or the taking of any action
based on the contents of this communication is strictly prohibited.

_____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:38:22 EDT