webForumDet fria alternativet

dynamisk uppsättning av konto på servern genom php

PHP

1 svar · 194 visningar · startad av patrik2002

Medlem sedan okt. 2001253 inlägg
Frågan#1

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)

Medlem sedan aug. 2002224 inlägg
#2

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

256 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
120 ms — deklarationer (db)
0 ms — hämta statistik (cache)
126 ms — hämta tråd, inlägg och bilagor (db)
128 ms — ändringar (db)