Admin account: where, when and how?

Where, when and how to create an administrator account / user for a private website?

So I ask what is the preferred method for creating the first admin account / user. In my case, this is for a private web application. I am talking about the account / user who will own the application and, if necessary, will create / promote other administrators. I think you can this root user guy?

Here are some of the ways I've come across on other sites / web applications.

Setup Wizard:
You can see this on the blog or on the forums. When you install the application, it will ask you to create an administrator user. A private web application most likely does not have this.

Installation file: The
file that you run to install the application. This file will create an administrator account for you.

Configuration Files:
A configuration file containing credentials for the administrator account.

Manually paste it into the database:
Manually paste the administrator information into the database.

+5
source share
4 answers

When:

In the boot phase. Someone suggested seeds.rb. I personally prefer to use the bootstrapper gem (with some add-ons that allow me to parse csv files).

, :

rake db:bootstrap

-, (, ..). script . , .

declarative_authorization .

"admin" ( , ) . , , (, ). , , "role_id". 0 , .

:

db/bootstrap/users.rb( yaml csv) . rake db:boostrap .

+3

, . RoR , , seeds.rb /your _app/db.

asp.net, , MSSQL , , Oracle. , script, .

php, install.php, , .

, .

+1

- ( , ), . . .

, , . .

- . : , , . - , , root - , .

+1

:  - . , . .

:  - , script . → ( , ...)

Configuration Files: Avoid. You require the user to know PHP, the internals of your application, perhaps the server-side configuration (anything above ftp can be "difficult")

Manually insert it into the database: To avoid * 2.

In addition, the last two solutions are not possible if you use password hashing (i.e. md5 or sha1 with a site-specific salt), which is quite a debt today.

+1
source

All Articles