Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2004 13:44:25 +0800
From:      Ihsan Junaidi Ibrahim <ihsan@synthexp.net>
To:        freebsd-questions@FreeBSD.org
Subject:   Detaching program from controlling terminal
Message-ID:  <40CE8CB9.9050504@synthexp.net>

next in thread | raw e-mail | index | archive | help
Hi all,

I'm somehow stuck in the loop now and am hoping some of you can give me 
pointers on how to proceed. Due to a customer requirement, I need to 
build a simple web-based (via cgi or php) script to change the system 
password. They found that sshing to the server and typing passwd to 
change the password is wee too involving hence the need to use a much 
friendlier interface. Letting the sysadmins change the user's password 
is not a good idea, as the sysadmins are outsourced and the users value 
their privacy. FYI, all the users has a /sbin/nologin shell set. I'm 
running FreeBSD 5.2.1.

I understand there are two primary way to change a user's password, 
either via passwd or pw. Since pw is a root-only program, that doesn't 
seem the best way to do it over the web so I'm left with passwd.

Since passwd gets its input from the controlling terminal, I simply 
cannot get an environment variable passed via stdin. Reading over 
daemon(8) I finally got it that I need to detach passwd from the 
controlling terminal and run it as a daemon.

This is where I entered the loop and never seem to get out of it. I 
couldn't get passwd to run properly because once it entered daemon mode, 
it locked up the whole terminal and subsequent tries also suffered the 
same fate.

If there's something that I have missed or there's better alternatives, 
please point it out. :)

Thanks,
Ihsan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40CE8CB9.9050504>