Re: alternate shell not running

2009-04-26 Thread Otto Moerbeek
On Sat, Apr 25, 2009 at 06:14:39PM -0700, Philip Guenther wrote:

 On Sat, Apr 25, 2009 at 5:48 PM, Aaron Martinez m...@proficuous.com wrote:
  So:
  1) what does the /etc/passwd entry for one of these users look like?
 
  lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script
 
 Are there any other passwd entries with that uid?
 What's the output of
ls -l /usr/local/bbox/bin/login_script

how did you edit the passwd file? with vipw or just vi? If you used
just vi, the changes would not be put in the various databases.

-Otto


 
 
  2) when you say they get a standard shell, what *EXACTLY* do you mean?
 (If you mean they get a /bin/sh prompt and it runs their
  .profile, then please say that)
 
  when logging in as user ght
  $ env
  _=/usr/bin/env
  SSH_CONNECTION=192.168.7.128 39782 192.168.7.254 22
 
 PATH=/home/lgf/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bi
 n:/usr/local/sbin:/usr/games:.
  SHELL=/usr/local/bin/login_script
  USER=lgf
  MAIL=/var/mail/ght
  HOME=/home/ght
  SSH_CLIENT=192.168.7.128 39782 22
  TERM=xterm
  SSH_TTY=/dev/ttyp0
  LOGNAME=ght
 
  $ lss
  ksh: lss: not found
 
  (looks like i'm getting ksh as my shell)
 
 It's interesting how it mixes USER=lgf with LOGNAME=ght.  sshd (and
 login) set those to the same value, so it would seem user lgf's
 .profile or similar is being parsed along the way.  I wonder what the
 'id' command would show at that point: ght, lgf, or something
 completely different?
 
 I guess my next step would be to use ktrace -i on a virtual console
 'getty' process, log in and out on that console to reproduce it, then
 stop the ktrace and examine the output of kdump to see what's actually
 being invoked, when, and by what.  Follow the fork() and execve()
 calls.
 
 Good luck!
 
 
 Philip Guenther



Re: alternate shell not running

2009-04-26 Thread Eric Furman
On Sat, 25 Apr 2009 23:13:26 -0400, Frank Bax f...@sympatico.ca
said:
 Aaron Martinez wrote:
  Aaron Martinez wrote:
  On Sat, Apr 25, 2009 at 3:39 PM, Aaron Martinez m...@proficuous.com
  wrote:
  1) what does the /etc/passwd entry for one of these users look like?
  lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script
 
  2) when you say they get a standard shell, what *EXACTLY* do you
  mean?
 (If you mean they get a /bin/sh prompt and it runs their
  .profile, then please say that)
  when logging in as user ght
 
 
  You changed shell for user lgf; then login as ght?
 
 
  sorry.. i was just preserving identities.. and missed one lgf entry..  
  the actual user is lgf.  i just was changing it to ght.  So everything is
  in fact lgf there is no mixing of id's.
  
  $ ls -l /usr/local/login_script
  -rwxr-xr-x  1 root  wheel  2132 Apr 23 00:22 /usr/local/login_script
 
 
 You issued ls command for a different script than the user's shell.
 

Specifically;
$ ls -l /usr/local/login_script
-rwxr-xr-x  1 root  wheel  2132 Apr 23 00:22 /usr/local/login_script

but login script used is:
/usr/local/bbox/bin/login_script

from;
lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script
   
There is some serious confusion going on here.
Stop trying to obfuscate everything and tell us what
you are actually doing. No one can help you until
you do otherwise.



alternate shell not running

2009-04-25 Thread Aaron Martinez
I'm running OpenBSD 4.4 Stable and have created a little shell script menu
program that I want certain users to have as their only interaction with
the system.  I created users using the script as their shell and also put
it in /etc/shells but when the user logs in they get a standard shell.  I
was testing it through ssh so I thought maybe it had something to do with
the environment but the same thing happens when I log in locally.  If log
in as root and then su - username the script runs as expected.

Is this the wrong way to do this?  Would it be better putting something in
the .profile?

Can anyone shed any light as to why this is happening?

Thanks,

Aaron Martinez



Re: alternate shell not running

2009-04-25 Thread Fred Crowson
On 4/25/09, Aaron Martinez m...@proficuous.com wrote:
 I'm running OpenBSD 4.4 Stable and have created a little shell script menu
 program that I want certain users to have as their only interaction with
 the system.  I created users using the script as their shell and also put
 it in /etc/shells but when the user logs in they get a standard shell.  I
 was testing it through ssh so I thought maybe it had something to do with
 the environment but the same thing happens when I log in locally.  If log
 in as root and then su - username the script runs as expected.

 Is this the wrong way to do this?  Would it be better putting something in
 the .profile?

 Can anyone shed any light as to why this is happening?

 Thanks,

 Aaron Martinez

As a mind reader I'm guessing permissions...
some more info might make it less of a guess



Re: alternate shell not running

2009-04-25 Thread Aaron Martinez
 On 4/25/09, Aaron Martinez m...@proficuous.com wrote:
 I'm running OpenBSD 4.4 Stable and have created a little shell script
 menu
 program that I want certain users to have as their only interaction with
 the system.  I created users using the script as their shell and also
 put
 it in /etc/shells but when the user logs in they get a standard shell.
 I
 was testing it through ssh so I thought maybe it had something to do
 with
 the environment but the same thing happens when I log in locally.  If
 log
 in as root and then su - username the script runs as expected.

 Is this the wrong way to do this?  Would it be better putting something
 in
 the .profile?

 Can anyone shed any light as to why this is happening?

 Thanks,

 Aaron Martinez

 As a mind reader I'm guessing permissions...
 some more info might make it less of a guess


I suppose it could be permissions, but the file/script is located in
/usr/local/bin with permissions set to 755.  Additionally, when i log in
as one of the restricted users that are supposed to have the script as
their shell, i have no problem running the script if i call it manually.

What additional information would be helpful? I'd be glad to provide it.

Aaron



Re: alternate shell not running

2009-04-25 Thread Philip Guenther
On Sat, Apr 25, 2009 at 3:39 PM, Aaron Martinez m...@proficuous.com wrote:
 I'm running OpenBSD 4.4 Stable and have created a little shell script menu
 program that I want certain users to have as their only interaction with
 the system.  I created users using the script as their shell and also put
 it in /etc/shells but when the user logs in they get a standard shell.  I
 was testing it through ssh so I thought maybe it had something to do with
 the environment but the same thing happens when I log in locally.  If log
 in as root and then su - username the script runs as expected.

 Is this the wrong way to do this?  Would it be better putting something in
 the .profile?

 Can anyone shed any light as to why this is happening?

Works for me:

$ ls -l /usr/local/bin/foo
-rwxr-xr-x  1 root  wheel  55 Apr 25 17:25 /usr/local/bin/foo
$ cat /usr/local/bin/foo
#!/bin/sh
echo hello!
read help
echo $help
exit 0
$ grep testing /etc/passwd
testing:*:1009:1009:Test User,,,:/home/users/testing:/usr/local/bin/foo
$

...and when I log in on a terminal as 'testing', I get the expected
hello! and it echos my first line on input and then exits.

So:
1) what does the /etc/passwd entry for one of these users look like?
2) when you say they get a standard shell, what *EXACTLY* do you mean?
   (If you mean they get a /bin/sh prompt and it runs their
.profile, then please say that)
3) what does the top of the shell script look like?


Philip Guenther



Re: alternate shell not running

2009-04-25 Thread Aaron Martinez
 On Sat, Apr 25, 2009 at 3:39 PM, Aaron Martinez m...@proficuous.com wrote:
 I'm running OpenBSD 4.4 Stable and have created a little shell script
 menu
 program that I want certain users to have as their only interaction with
 the system.  I created users using the script as their shell and also
 put
 it in /etc/shells but when the user logs in they get a standard shell.
  I
 was testing it through ssh so I thought maybe it had something to do
 with
 the environment but the same thing happens when I log in locally.  If
 log
 in as root and then su - username the script runs as expected.

 Is this the wrong way to do this?  Would it be better putting something
 in
 the .profile?

 Can anyone shed any light as to why this is happening?

 Works for me:

 $ ls -l /usr/local/bin/foo
 -rwxr-xr-x  1 root  wheel  55 Apr 25 17:25 /usr/local/bin/foo
 $ cat /usr/local/bin/foo
 #!/bin/sh
 echo hello!
 read help
 echo $help
 exit 0
 $ grep testing /etc/passwd
 testing:*:1009:1009:Test User,,,:/home/users/testing:/usr/local/bin/foo
 $

 ...and when I log in on a terminal as 'testing', I get the expected
 hello! and it echos my first line on input and then exits.

 So:
 1) what does the /etc/passwd entry for one of these users look like?

lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script

 2) when you say they get a standard shell, what *EXACTLY* do you mean?
(If you mean they get a /bin/sh prompt and it runs their
 .profile, then please say that)

when logging in as user ght
$ env
_=/usr/bin/env
SSH_CONNECTION=192.168.7.128 39782 192.168.7.254 22
PATH=/home/lgf/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
SHELL=/usr/local/bin/login_script
USER=lgf
MAIL=/var/mail/ght
HOME=/home/ght
SSH_CLIENT=192.168.7.128 39782 22
TERM=xterm
SSH_TTY=/dev/ttyp0
LOGNAME=ght


$ lss
ksh: lss: not found

(looks like i'm getting ksh as my shell)


 3) what does the top of the shell script look like?

#!/bin/ksh

tput clear

goodchoice=
until [ -n $goodchoice ]
do

echo 'Please choose one of the following:




 Philip Guenther



Re: alternate shell not running

2009-04-25 Thread Philip Guenther
On Sat, Apr 25, 2009 at 5:48 PM, Aaron Martinez m...@proficuous.com wrote:
 So:
 1) what does the /etc/passwd entry for one of these users look like?

 lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script

Are there any other passwd entries with that uid?
What's the output of
   ls -l /usr/local/bbox/bin/login_script


 2) when you say they get a standard shell, what *EXACTLY* do you mean?
(If you mean they get a /bin/sh prompt and it runs their
 .profile, then please say that)

 when logging in as user ght
 $ env
 _=/usr/bin/env
 SSH_CONNECTION=192.168.7.128 39782 192.168.7.254 22

PATH=/home/lgf/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bi
n:/usr/local/sbin:/usr/games:.
 SHELL=/usr/local/bin/login_script
 USER=lgf
 MAIL=/var/mail/ght
 HOME=/home/ght
 SSH_CLIENT=192.168.7.128 39782 22
 TERM=xterm
 SSH_TTY=/dev/ttyp0
 LOGNAME=ght

 $ lss
 ksh: lss: not found

 (looks like i'm getting ksh as my shell)

It's interesting how it mixes USER=lgf with LOGNAME=ght.  sshd (and
login) set those to the same value, so it would seem user lgf's
.profile or similar is being parsed along the way.  I wonder what the
'id' command would show at that point: ght, lgf, or something
completely different?

I guess my next step would be to use ktrace -i on a virtual console
'getty' process, log in and out on that console to reproduce it, then
stop the ktrace and examine the output of kdump to see what's actually
being invoked, when, and by what.  Follow the fork() and execve()
calls.

Good luck!


Philip Guenther



Re: alternate shell not running

2009-04-25 Thread Frank Bax

Aaron Martinez wrote:

On Sat, Apr 25, 2009 at 3:39 PM, Aaron Martinez m...@proficuous.com wrote:
1) what does the /etc/passwd entry for one of these users look like?


lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script


2) when you say they get a standard shell, what *EXACTLY* do you mean?
   (If you mean they get a /bin/sh prompt and it runs their
.profile, then please say that)


when logging in as user ght




You changed shell for user lgf; then login as ght?



Re: alternate shell not running

2009-04-25 Thread Aaron Martinez
 Aaron Martinez wrote:
 On Sat, Apr 25, 2009 at 3:39 PM, Aaron Martinez m...@proficuous.com
 wrote:
 1) what does the /etc/passwd entry for one of these users look like?

 lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script

 2) when you say they get a standard shell, what *EXACTLY* do you
 mean?
(If you mean they get a /bin/sh prompt and it runs their
 .profile, then please say that)

 when logging in as user ght



 You changed shell for user lgf; then login as ght?


sorry.. i was just preserving identities.. and missed one lgf entry..  
the actual user is lgf.  i just was changing it to ght.  So everything is
in fact lgf there is no mixing of id's.

$ ls -l /usr/local/login_script
-rwxr-xr-x  1 root  wheel  2132 Apr 23 00:22 /usr/local/login_script

thanks again for the ideas.

Aaron



Re: alternate shell not running

2009-04-25 Thread Frank Bax

Aaron Martinez wrote:

Aaron Martinez wrote:

On Sat, Apr 25, 2009 at 3:39 PM, Aaron Martinez m...@proficuous.com
wrote:
1) what does the /etc/passwd entry for one of these users look like?

lgf:*:1010:1::/home/ght:/usr/local/bbox/bin/login_script


2) when you say they get a standard shell, what *EXACTLY* do you
mean?
   (If you mean they get a /bin/sh prompt and it runs their
.profile, then please say that)

when logging in as user ght



You changed shell for user lgf; then login as ght?


sorry.. i was just preserving identities.. and missed one lgf entry..  
the actual user is lgf.  i just was changing it to ght.  So everything is

in fact lgf there is no mixing of id's.

$ ls -l /usr/local/login_script
-rwxr-xr-x  1 root  wheel  2132 Apr 23 00:22 /usr/local/login_script



You issued ls command for a different script than the user's shell.