Gabriel,

How about we cheat?  The script below (starting with:  #!/bin/sh) should
work whether it is IP or hostname.

Try this script:

#####  BEGIN SCRIPT  ######

#!/bin/sh
CLIENT=$(echo $DISPLAY | cut -d: -f1)
CLIENT1=$(echo $CLIENT | cut -d. -f1)
CLIENT1_CHECK=$(echo $CLIENT1 | sed -e 's/[0-9]*//g')
USER_PREFIX="auto"

if [ -z "${CLIENT1_CHECK)" ]; then
    # CLIENT is an IP
    echo "${USER_PREFIX}$(echo $CLIENT | cut -d. -f4)"
    exit 0
else
    # CLIENT is a hostname
    echo "${USER_PREFIX}$(echo $CLIENT1 | sed -e 's/^[a-zA-Z0]*//')"
    exit 0
fi 

#####  END SCRIPT    ######

-Gadi


On Wed, 2008-11-26 at 17:14 +0000, gabriel lopez wrote:
> Gideon: 
>    Thanks for this detailed explanation.
> I am not a programmer and just copied the script i found in internet
> but did not know what was it doing.
> Now i undestand a little more.
>  
> On the script i added a line to echo $DISPLAY and $CLIENT to a file
> and the restarted the client.
> The values are:
> Display 192.168.20.120:0
> Client  192.
> quote:
> >If that is the problem, then you ask - why is gdm using IP and not
> > hostname? Does my workstation have a hostname? Is my /etc/hosts
> > correct? Or, does gdm no longer resolve DISPLAY to hostname? Well,
> the
> > first two are easy to check. 
> 
> How do i check which could be the problem?
> 
> Mi /etc/hosts is like this
> ---------------------------------------------------------------------------------------------------------------------------------------------
> 127.0.0.1        lofa   localhost
> ## lofa-begin ##
> #
> # The lines between 'lofa-begin' and 'lofa-end' were added
> # on: Fri Oct 24 08:01:52 2008, by the lofacfg configuration tool.
> # For more information, visit the lofa homepage
> # at http://www.lofa.org
> #
> 
> 192.168.20.1           ws001.lofa    ws001
> 192.168.20.2           ws002.lofa    ws002
> .
> .
> .
> 192.168.20.120         ws120.lofa    ws120
> 192.168.20.121         ws121.lofa    ws121
> 192.168.20.122         ws122.lofa    ws122
> 192.168.20.123         ws123.lofa    ws123
> .
> .
> 192.168.20.252         ws252.lofa    ws252
> 192.168.20.253         ws253.lofa    ws253
> 
> ## lofa-end ##
> ------------------------------------------------------------------------------------------------------------------------------
> 
> 
> > Date: Tue, 25 Nov 2008 11:39:51 -0500
> > From: [EMAIL PROTECTED]
> > To: [email protected]
> > Subject: Re: [Ltsp-discuss] LTSP4.2 autologin
> > 
> > Gabriel,
> > 
> > It is always best to understand how the scripts should work before
> > implementing them - otherwise it makes things harder to debug.
> > 
> > Your instructions are basically making use of gdm's ability to
> specify a
> > script to be executed when retrieving the autologin user. The output
> of
> > such a script *must* be a valid username. If the output of the
> script
> > is empty (no output), then gdm will use the "root" user.
> > 
> > Now, since that is what gdm is using, it tells you that the script
> is
> > indeed not returning a username as output. Let's look at the script
> and
> > figure out why:
> > 
> > The first line in the script cuts the DISPLAY environment variable
> by
> > periods and returns the first part. It will use this first part to
> > figure out what user to return. That works ok, provided that the
> first
> > part of the DISPLAY variable is a workstation name. Is it?
> > 
> > If it is not a hostname but an IP address, the result of returning
> the
> > first part would be a number! That number would not match any of the
> > cases you set up and therefore return no autologin user. That could
> be
> > the problem.
> > 
> > How to check? Well, tell the script to return $CLIENT. Then, if it
> is
> > a number, gdm may say "User 192 will login in 5 seconds..." And you
> will
> > say to yourself, "User 192?!"
> > 
> > If that is the problem, then you ask - why is gdm using IP and not
> > hostname? Does my workstation have a hostname? Is my /etc/hosts
> > correct? Or, does gdm no longer resolve DISPLAY to hostname? Well,
> the
> > first two are easy to check. If you discover it is #3, then you may
> > need to modify your script to autologin users based upon IP rather
> than
> > hostname.
> > 
> > Hope that helps,
> > 
> > -Gadi
> > 
> > 
> > On Mon, 2008-11-24 at 21:01 +0000, gabriel lopez wrote:
> > > GDM LTSP4.2 Autologin‏
> > > De:
> > > gabriel lopez
> > > ([EMAIL PROTECTED]) 
> > > Enviado:
> > > viernes, 21 de noviembre de 2008
> > > 03:59:32 p.m.
> > > Para: 
> > > LTSP
> > > ([email protected])
> > > I am in the process of installing LTSP4.2 on Mandriva 2009. There
> has
> > > been problem because i has not found specific instructions for
> > > Mandriva 2009 but Instructions for Mandriva 2006 and 2007 work 95%
> of
> > > the time.
> > > What i have to solve now is autologin on terminals.
> > > I have tried instructions for KDM and GDM and none works.
> > > I has gone back to GDM and use this instructions:
> > > 
> > >
> #####################################################################
> > > Create a user ID for each client machine that will autologin. This
> > > how-to assumes the IDs are auto1, auto2, auto3, etc. 
> > > Create the /usr/bin/autologin script. This script figures out
> which
> > > client it's running on and then passes a correpsonding login ID to
> GDM
> > > for the autologin. Here's a sample script, which you can modify to
> > > suit your needs: 
> > > --------autologin
> > > script--------------------------------------------------
> > > #!/bin/bash
> > > CLIENT=$(echo $DISPLAY || cut -d. -f1)
> > > case "$CLIENT" in
> > > "ws001") disp=auto1;;
> > > "ws002") disp=auto2;;
> > > "ws003") disp=auto3;;
> > > esac
> > > echo $disp
> > > ----------------------------------------------------
> > > Be sure the $disp variable is being set to valid user IDs you
> created
> > > in the previous step. Remember to make the autologin script
> > > executable ('chmod +x /usr/bin/autologin').
> > > Modify /etc/gdm/custom.conf and add the following settings under
> the
> > > daemon and security sections. Be sure to include the pipe
> character at
> > > the end of the TimedLogin line.* 
> > > -------------------custom.conf--------------------------------
> > > daemon
> > > 
> > > AutomaticLoginEnable=true
> > > TimedLoginEnable=true
> > > TimedLogin=/usr/bin/autologin|
> > > TimedLoginDelay=30
> > > 
> > > security
> > > 
> > > AllowRemoteAutoLogin=true
> > > ----------------------------------------------------------------
> > > Restart GDM. This will kick all users, including you at the
> console,
> > > off the system and send them back to the login screen. As such,
> it's
> > > best if you switch to a command prompt console by pressing
> > > Ctrl-Alt-F1, and login in as root, if you aren't already. Then,
> > > restart gdm: 
> > > gdm-restart
> > > 
> > >
> ###################################################################
> > > 
> > > 
> > > The problem is that i can see the login screen on the terminal and
> a
> > > message that say somthiong like
> > > "root wil login in 30,29,.... seconds" but root never login and th
> > > message start again "root wil login in 30,29,.... seconds" and so
> on.
> > > I DO NOT WANT TO LOGIN AS ROOT BUT AS A REGULAR USER. auto1 in
> this
> > > case.
> > > 
> > > What i thing is that something is missing because i do not see how
> the
> > > value "auto1" stored in $disp on the script, is passed to GDM as
> the
> > > name of the user i want lo login as.
> > > 
> > > Any help?
> > > 
> > > 
> > >
> ______________________________________________________________________
> > > Discover the new Windows Vista Learn more!
> > >
> -------------------------------------------------------------------------
> > > This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> > > Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> > > Grand prize is a trip for two to an Open Source event anywhere in
> the world
> > > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > >
> _____________________________________________________________________
> Ltsp-discuss mailing list. To un-subscribe, or change prefs, goto:
> https://lists.sourceforge.net/lists/listinfo/ltsp-discuss For
> additional LTSP help, try #ltsp channel on irc.freenode.net
> > -- 
> > --------------------------------------------------------
> > Gideon Romm | Proud LTSP Developer
> > [EMAIL PROTECTED]
> > 
> > Support LTSP! Buy your hardware at:
> > 
> > www.DisklessWorkstations.com
> > www.DisklessThinClients.com 
> > 
> > (use coupon code: LTSP5P for 5% off thin clients from
> DisklessThinClients.com)
> > 
> > 
> > 
> >
> -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> > Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> > Grand prize is a trip for two to an Open Source event anywhere in
> the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >
> _____________________________________________________________________
> > Ltsp-discuss mailing list. To un-subscribe, or change prefs, goto:
> > https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
> > For additional LTSP help, try #ltsp channel on irc.freenode.net
> 
> 
> ______________________________________________________________________
> Explore the seven wonders of the world Learn more!
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _____________________________________________________________________ 
> Ltsp-discuss mailing list. To un-subscribe, or change prefs, goto: 
> https://lists.sourceforge.net/lists/listinfo/ltsp-discuss For additional LTSP 
> help, try #ltsp channel on irc.freenode.net
-- 
--------------------------------------------------------
Gideon Romm | Proud LTSP Developer
[EMAIL PROTECTED]

Support LTSP!  Buy your hardware at:

        www.DisklessWorkstations.com
        www.DisklessThinClients.com 
 
(use coupon code: LTSP5P for 5% off thin clients from DisklessThinClients.com)



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.freenode.net

Reply via email to