From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 25 02:15:02 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1930A16A4CE for ; Thu, 25 Mar 2004 02:15:02 -0800 (PST) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0B94A43D3F for ; Thu, 25 Mar 2004 02:15:01 -0800 (PST) (envelope-from ganbold@micom.mng.net) Received: from [202.179.0.164] (helo=ganbold.micom.mng.net) by publicd.ub.mng.net with asmtp (Exim 4.30; FreeBSD) id 1B6RoE-000ErN-RY for freebsd-hackers@freebsd.org; Thu, 25 Mar 2004 18:09:58 +0800 Message-Id: <6.0.3.0.2.20040325180311.02a294d8@202.179.0.80> X-Sender: ganbold@micom.mng.net@202.179.0.80 X-Mailer: QUALCOMM Windows Eudora Version 6.0.3.0 Date: Thu, 25 Mar 2004 18:19:54 +0800 To: freebsd-hackers@freebsd.org From: Ganbold Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Question regarding shell user creation at login time X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2004 10:15:02 -0000 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 #include 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