> 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:10000::/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

Reply via email to