1847639 Members
3780 Online
110265 Solutions
New Discussion

Re: auto logout

 
SOLVED
Go to solution
Mel Burslan
Honored Contributor

Re: auto logout

did you add the script that you are setting as the users' default shell to the end of /etc/shells file ?
________________________________
UNIX because I majored in cryptology...
HPquestion
Regular Advisor

Re: auto logout


I dodn't see any file called /etc/shells in my installation.

Thanks!
Mel Burslan
Honored Contributor

Re: auto logout

I am not sure about this somewhere I remember readin, if you are going to assign a user a non-standard shell, i.e., anything other than these :

/sbin/sh
/usr/bin/sh
/usr/bin/rsh
/usr/bin/ksh
/usr/bin/rksh
/usr/bin/csh

you have to create an /etc/shells and add all shells used by users of the system (you can derive this by running "cat /etc/passwd|cut -d: -f 7|sort|uniq" command) as well as your non-standard shell.

Try it and see if it makes a difference. If it does not, you can always erase the /etc/shells file after the test.
________________________________
UNIX because I majored in cryptology...
Dennis Handly
Acclaimed Contributor

Re: auto logout

>it's not working at all.

Not working how? Have you added something in your script to detect it has even been executed?

BASE=$(basename $0)
LOG=/var/tmp/${BASE}.$$.log
echo "$BASE was executed on: $(date)" >> $LOG
exec /your/program

>Mel: I am not sure about this somewhere I remember reading, if you are going to assign a user a non-standard shell

Right. Typically this is only needed if you are going to use ftp for that user.
HPquestion
Regular Advisor

Re: auto logout

Dennis,

Its a X -windows application...I don't see the application coming up. There is no need to build the log to check the status.

If I let the user open the shell and execute it...it works fine.. But If I call it as a startup program ( instead of some shell like /usr/bin/ksh), application is not appearing at all unless I add a line like /usr/bin/ksh as I have explained in my earlier posting.

Thanks for any help on this!
Mel Burslan
Honored Contributor

Re: auto logout

so if the application is not starting as a shell, it means that your login is either failing or getting terminated immediately upon login. Which one is the case ? when you look at last and lastb outputs, right after one of these users attempt logging in, where does it get logged ? also while the login is attempted, did you watch the output of

tail -f /var/adm/syslog/syslog.log

anything gets written over there ?
________________________________
UNIX because I majored in cryptology...
Dennis Handly
Acclaimed Contributor

Re: auto logout

>I don't see the application coming up. There is no need to build the log to check the status.

The log was just to make sure the script was executed.

>Mel: when you look at last(1) output

No need to look at those if you have that log for the script.
HPquestion
Regular Advisor

Re: auto logout

>so if the application is not starting as a >shell, it means that your login is either >failing or getting terminated immediately ?
>upon login. Which one is the case ?

I can see the logon entry in 'last'. But it doesn't display the Xwindows clock and logout itself. What to do?
HPquestion
Regular Advisor

Re: auto logout

#!/usr/bin/ksh
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
BASE=$(basename $0)
LOG=/backup/Taxware/toolkit/${BASE}.$$.log
echo "$BASE was executed on: $(date)" > $LOG
/usr/bin/X11/xclock

Its executing the script as I can see the logfile..but clock is not appearing at all.

DISPLAY is not an issue...

Appreciate any help on this.
Dennis Handly
Acclaimed Contributor

Re: auto logout

>It's executing the script as I can see the logfile.. but clock is not appearing at all.
>DISPLAY is not an issue.

Why do you think so?
Do you keep the script's stdout/stderr?
Is the script still running?
Here is why you have that logfile. You can echo $DISPLAY to that file.
And echo info after xclock finishes.
HPquestion
Regular Advisor

Re: auto logout

After I hardcoded the DISPLAY settings, script started working fine and I can see the Xlock now. How to fix the DISPLAY variable programatically?

#export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
export DISPLAY=10.227.16.23:0.0
BASE=$(basename $0)
LOG=/backup/Taxware/toolkit/${BASE}.log
echo "$BASE was executed on: $(date)" > $LOG
/usr/bin/X11/xclock
echo "$BASE was executed on: $(date)" >> $LOG 2>&1
Dennis Handly
Acclaimed Contributor

Re: auto logout

>How to fix the DISPLAY variable programatically?
#export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
export DISPLAY=10.227.16.23:0.0

What was the wrong value?
HPquestion
Regular Advisor

Re: auto logout

"
What was the wrong value?
"
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0 doesn't work.

export DISPLAY=10.227.16.23:0.0 is hardcoded and won't work for other users.

do we have anyway to capture IP address and put that in DISPLAY variable
Dennis Handly
Acclaimed Contributor

Re: auto logout

>export DISPLAY=$(who -muR | awk '{print $NF}'):0.0 doesn't work.

Again, what is the value of $DISPLAY for this case?
Does it work correct for a session?
HPquestion
Regular Advisor

Re: auto logout

it doesn't work.
its returning
ric2bptc21:0.0
Dennis Handly
Acclaimed Contributor

Re: auto logout

>it's returning: ric2bptc21:0.0

Any connection between ric2bptc21 and 10.227.16.23?

Can you try this by hand or logging:
who -mR

Is $DISPLAY already set correctly?
How about $TERM? (Some emulators may add it there.)
Dennis Handly
Acclaimed Contributor

Re: auto logout

I checked my systems, "who -umR" works fine, returns a FQDN.
Suraj K Sankari
Honored Contributor

Re: auto logout

Hi,
See man page of who

-R Displays the userâ s host name. If the user is logged in on a tty, who displays the
string returned from gethostname() (see gethostname(2)). If the user is not
logged in on a tty and the host name stored in the /etc/utmp or named file has not
been truncated when stored (meaning that the entire host name was stored with no
loss of information), it is displayed as it was stored. Otherwise, the gethostbyaddr()
function is called with the internet address of the host (see
gethostent(3N)). The host name returned by gethostbyaddr() is displayed
unless it returns an error, in which case the truncated host name is displayed.

Suraj
HPquestion
Regular Advisor

Re: auto logout

who -muR is returning random desktop user machine from the network. Not sure why its not working for me. I an using relection software.
Bill Hassell
Honored Contributor

Re: auto logout

> who -muR is returning random desktop user machine from the network. Not sure why its not working for me. I an using relection software.

who -muR is returning the IP address of the incoming host. You are apparently going through more than one system to get to the destination. Therefore, you can't use the who -muR method. Just hardcode your IP address like this:

export DISPLAY=12.34.56.78:0.0

Verify that it works with xclock. Then run your custom program.


Bill Hassell, sysadmin
HPquestion
Regular Advisor

Re: auto logout

>who -muR is returning the IP address of >the incoming host.
In my case its returning the name of other desktop/laptop user machine randomely from the netwrok... Is it normal :-)

> Just hardcode your IP address like this:
Hardcoding IP won;t work as the script need to be executed by other users with different IP.

Thanks!
Bill Hassell
Honored Contributor

Re: auto logout

> Hardcoding IP won;t work as the script need to be executed by other users with different IP.

You need to describe all the machines in between your PC and the HP system. HP-UX knows the IP address of the machine that is directly connected. If you use several different machines, or you are using a networking tunnel, then you must supply the IP address of your PC as part of the login process. Whether there are two or twenty machines in your connection chain, there is no simple way to track down your PC's address.

Since you are using WRQ'a Reflection/X software, you have the ability to code the startup of your HP-UX program including setting the DISPLAY variable and passing it to the remote system. The above examples only work with a simple connection.


Bill Hassell, sysadmin