Question regarding shell user creation at login time

From: Ganbold <ganbold_at_micom.mng.net>
Date: Fri, 26 Mar 2004 12:54:49 +0800
Hi,

I'm using FreeBSD 5.2-CURRENT and I'm trying to write a small C program 
which in turn calls perl script.
Perl script creates user account. I created user called "new" and put new.c 
and new.pl into its directory.
Then I changed shell for user new to point to /home/new/new.
The idea is I want to run free shell server. When first time some user logs 
in as user new it should execute new.pl
and ask to enter user name etc. and creates new account.

My new.c program is:
--------------------------------------------------------------
#include <stdio.h>
#include <unistd.h>

int main(void) {

   char *env[] = { "TERM=vt100", (char *)0 };

   execle("/home/new/new.pl","new.pl",(char *)0,env);

   return 0;
}
--------------------------------------------------------------
I compile it and make it setuid root:
gcc new.c -o new
chmod 4750 new
chown root:new new
--------------------------------------------------------------

# ls -l
-r--r-----  1 root  new      767 Mar 24 17:43 .cshrc
-r--r-----  1 root  new        2 Mar 25 15:41 .hushlogin
-r--r-----  1 root  new      248 Mar 24 17:43 .login
-r--r-----  1 root  new      158 Mar 24 17:43 .login_conf
-r--r-----  1 root  new      373 Mar 24 17:43 .mail_aliases
-r--r-----  1 root  new      331 Mar 24 17:43 .mailrc
-r--r-----  1 root  new      797 Mar 24 17:43 .profile
-r--r-----  1 root  new      276 Mar 24 17:43 .rhosts
-r--r-----  1 root  new      975 Mar 24 17:43 .shrc
-rwsr-x---  1 root  new     4549 Mar 25 17:37 new
----------  1 root  wheel    173 Mar 25 17:37 new.c
-r-x------  1 root  wheel  15430 Mar 25 15:16 new.pl
-rw-r--r--  1 root  wheel     52 Mar 25 16:52 new.sh

But when I try to login as user new and when I type password the window 
just closes.
When I run su new from console and after I type password it seems just 
exits without doing nothing.

new.pl works fine without any problem if I run ./new from console.

Can somebody give me some hints and advices to help me solve this problem?
Is there any other configuration changes I need? Like /etc/login.conf etc?
I'm new to this kind of issue and I appreciate if somebody in this list 
help me.

TIA,

Ganbold
Received on Thu Mar 25 2004 - 19:49:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:49 UTC