---
title: "dynamisk uppsättning av konto på servern genom php"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/68556-dynamisk-uppsättning-av-konto-på-servern-genom-php"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "patrik2002"
published: "2003-02-17T18:11:13.000Z"
updated: "2003-02-18T08:18:17.000Z"
replies: 1
views: 199
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/68556-dynamisk-uppsättning-av-konto-på-servern-genom-php"
---

# dynamisk uppsättning av konto på servern genom php

## #1 — patrik2002, 2003-02-17T18:11Z

hejsan! jag skulle vilja veta hur jag gör så att man kan skapa ett användarkonto, med ett visst användarnamn, lösenord och home-directory och sätta upp chmod 755 på den mappen, med ett php skript...nån som vet?(det är en linux server)

Permalänk: https://www.webforum.nu/p/68556

## #2 — Gaqzi, 2003-02-18T08:18Z

Lite tips iallafall

pw useradd -n \<login\> -g \<grupp\> -s \<shell\> -m /home/\<login\> 

> \-h fd	   
> 
> This option provides a special interface by which interac\_
> 		   tive scripts can set an account password using pw.  Because
> 		   the command line and environment are fundamentally insecure
> 		   mechanisms by which programs can accept information, pw
> 		   will only allow setting of account and group passwords via
> 		   a file descriptor (usually a pipe between an interactive
> 		   script and the program).  sh, bash, ksh and perl all pos\_
> 		   sess mechanisms by which this can be done.  Alternatively,
> 		   pw will prompt for the user's password if -h 0 is given,
> 		   nominating stdin as the file descriptor on which to read
> 		   the password.  Note that this password will be read only
> 		   once and is intended for use by a script rather than for
> 		   interactive use.  If you wish to have new password confir\_
> 		   mation along the lines of passwd(1), this must be imple\_
> 		   mented as part of an interactive script that calls pw.
> 
> 		   If a value of \`-' is given as the argument fd, then the
> 		   password will be set to \`\*', rendering the account inacces\_
> 		   sible via password-based login.

 

likväl:

> \-w method	   The -w option sets the default method used to set passwords
> 		   for newly created user accounts.  method is one of:
> 
> 			 no	 disable login on newly created accounts
> 			 yes	 force the password to be the account name
> 			 none	 force a blank password
> 			 random  generate a random password
> 
> 		   The \`random' or \`no' methods are the most secure; in the
> 		   former case, pw generates a password and prints it to std\_
> 		   out, which is suitable where you issue users with passwords
> 		   to access their accounts rather than having the user nomi\_
> 		   nate their own (possibly poorly chosen) password.  The \`no'
> 		   method requires that the superuser use passwd(1) to render
> 		   the account accessible with a password.

 

Lite problem med lösenordet då måste tyvärr skriva ett eget script extra där som du ser, men ifall du gör det får du gärna dela med dej ;) §jr 

Och <http://www.freebsd.org/cgi/man.cgi?query=pw&apropos=0&sektion=0&manpath=FreeBSD+4.7-RELEASE&format=html> här har du MAN sidan för pw  :e

Permalänk: https://www.webforum.nu/p/953232

---

Tråden på webben: https://www.webforum.nu/amne/php/68556-dynamisk-uppsättning-av-konto-på-servern-genom-php
