Re: script wrapper for smbpasswd?
- From: The Natural Philosopher <a@xxx>
- Date: Fri, 31 Aug 2007 13:23:30 +0100
Davide Bianchi wrote:
On 2007-08-31, The Natural Philosopher <a@xxx> wrote:Oh been ther, done that, just wondered if smbpasswd would work the same in a rooted script as it does in a root console session.
yes it does.
Now that IS a thought. I didn't know you could...
yes, samba 3 can use different 'password backend', including
SQL and LDAP.
MM... The question is where to find out how to set it all up...
I don't have MySQL users as such, since the only 'user' that accesses it is the apache server/php stuff, using a single 'login'
I've managed to set up .htpasswd files from within the php..that works well..
function htadduser($filename,$logname, $password)
{
$logname=rtrim($logname); //strip any trailing spaces
$password=rtrim($password);
$fp=fopen($filename,"r+"); // open reading AND writing
if($fp)
{
while (!feof($fp))
{
$buffer = fgets($fp, 4096);
$username=explode(":",$buffer); //extract the actual username
//echo($username[0]."<BR>");
if($logname==$username[0]) // can't add an existing user.
{
fclose($fp);
return -1;
}
}
// OK we are at the file end, and we haven't found an identical user.
// time to get an encrypted password
$salt.=chr(rand(64,126));
$salt.=chr(rand(64,126)); // two character salt to force DES
$hash=crypt($password,$salt);
echo("adding entry:".$logname.":".$hash."<BR>");
fseek($fp, 0, SEEK_END); // make sure we ARE at the file end..
// remove for now while testing !!
// fprintf($fp,"%s:%s\n", $logname,$hash);
fclose ($fp);
return 0;
}
return -1; // no password file!
}
What I want is a similar thing that does that for Samba, however its configured..and probably the Unix adduser stuff as well. Since Samba uses unix file perms to access the shares
Hmm. Maybe a set root id script IS the answer to run through the SMBpasswd AND the Linux system passwd and adduser stuff.
Davide.
- References:
- script wrapper for smbpasswd?
- From: The Natural Philosopher
- Re: script wrapper for smbpasswd?
- From: The Natural Philosopher
- script wrapper for smbpasswd?
- Prev by Date: hot sell nike jordan adidas puma prada jeans sony
- Next by Date: www.nikejordanaaa.com sell nike jordan......
- Previous by thread: Re: script wrapper for smbpasswd?
- Next by thread: Re: script wrapper for smbpasswd?
- Index(es):