Operating System - HP-UX
1844567 Members
3347 Online
110233 Solutions
New Discussion

Re: remove xterm query on login

 
SOLVED
Go to solution
Kalin Evtimov
Regular Advisor

remove xterm query on login

Hi!
I need to remove the xterm query on login. Always when I switch the user with "su- user" I get:

TERM=(hp)

and have to type "xterm". I want to avoid that, but don't know how, will be greatful for any ideas.

Thank you!
10 REPLIES 10
Luk Vandenbussche
Honored Contributor

Re: remove xterm query on login

Hi,

Change your .profile

Remove the section

if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi

Replace it by

TERM=xterm;export TERM
Bill Hassell
Honored Contributor
Solution

Re: remove xterm query on login

Hardcoding TERM=xterm is OK for a single user workstation. But if other people may login to the same system, there's a good chance that they may not be using xterm and the TERM value will cause menu programs to fail. Replace the deprecated tset code:

if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi

with:

eval $(ttytype -s)

Not only does this query the terminal to find out exactly what terminal it is, but it always runs whereas the code above only runs if TERM is not set. TERM can be set by a telnet subcode from another computer and the likelihood that the remote computer defines the TERM value correctly (for HP-UX) is very low. The eval above will set the terminal characteristics correctly each time. Check out what ttytype does with the command:

ttytype -s


Bill Hassell, sysadmin
Kalin Evtimov
Regular Advisor

Re: remove xterm query on login

Thank you. Just learned something. Unfortunately I still have a small problem:

running "sudo -u user stopsap", I get an ouput:

SAPSYSTEMNAME not set.

This means, that sudo didn't take the user environment and didn't set this variable.

Can I set it up over sudo?
Bill Hassell
Honored Contributor

Re: remove xterm query on login

sudo does not login in your example, it simply changes your user ID temporarily for the one command. You need to establish what is needed for this command and include it in your command. The other is to run the new user's .profile as part of your command.


Bill Hassell, sysadmin
Kalin Evtimov
Regular Advisor

Re: remove xterm query on login

This sounds good. Could you tell me how to reload a .profile, or at least what should I look for?
Arunvijai_4
Honored Contributor

Re: remove xterm query on login

Hello,

You asked " Could you tell me how to reload a .profile, or at least what should I look for?"

# . /.profile
or
$ . $HOME/.profile

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Kalin Evtimov
Regular Advisor

Re: remove xterm query on login

Hello!

I ment how to do this in a single command using sudo, for example running the profile-script for user "admin" and running any command, that requires the .profile to be run before executing this command. :(
Arunvijai_4
Honored Contributor

Re: remove xterm query on login

Hello,

You can use # su - to execute profile everytime when you do "su".

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Kalin Evtimov
Regular Advisor

Re: remove xterm query on login

But I cannot invoke su from a perl-script, this is the problem. From the commandline there is no problem.

From Perl I have to take sudo, but then occurs the problem with the environment.
Kalin Evtimov
Regular Advisor

Re: remove xterm query on login

I got it:

su - $user -c $command $options
_______________________________________