Skip to content

User Passwords: resetting, dumping, inspecting.

shadowbq edited this page Oct 1, 2014 · 3 revisions

Change Passwords

Remember, the default user is "snorby@snorby.org" and the password is "snorby". You'll want to change this immediately after installation.

Login to your Snorby instance and go to "Settings". You'll be prompted for your name, email, password.

Finish by clicking Update Settings.

Dumping Users Table for backups

Dumping Users from localhost Snorby Database using 'userinteraction' password

mysqldump -u root -p snorby users > sqlusers.db

Restoring Users from localhost Snorby Database using 'userinteraction' password

mysql -u root -p snorby < sqlusers.db

More complex connection string that might be used in migrations.

AWS Migration Restoration after db:setup task is ran.

mysql -h snorbydb.a123j7aaf5rtg.us-east-1.rds.amazonaws.com --database=snorby -u snorby --password=sn0rBys3cr3tstuff < snorby_users.backup_epoch.sql

Reseting a User's Password on the CLI using Rails Console

Launch Rails Console

Note: your method of launching rails console in production may be significantly different.

/usr/local/www/snorby/$> script/rails c

-or-

Modern Bundle execution wrapper of rails gem bin

/usr/local/www/snorby/$>  sudo -u www RAILS_ENV="production" bundle exec script/rails c

Using Rail's Console to reset user's password.

u = User.find_by_email("foo@bar.com")
u.password="NewUnencryptedPassword123"
u.password_confirmation="NewUnencryptedPassword123"
u.save

Default Snorby Password

As a reference the snorby administrator is inserted via a datamapper database rake seed task db/seeds.rb.

User.create(:name => 'Administrator', :email => 'snorby@snorby.org', :password => 'snorby', :password_confirmation => 'snorby', :admin => true)

Database User's Table

Current Schema of the Users table.

mysql> describe users;    
+------------------------+------------------+------+-----+---------------------+----------------+
| Field                  | Type             | Null | Key | Default             | Extra          |
+------------------------+------------------+------+-----+---------------------+----------------+
| email                  | varchar(255)     | NO   |     |                     |                |
| encrypted_password     | varchar(128)     | NO   |     |                     |                |
| remember_token         | varchar(255)     | YES  |     | NULL                |                |
| remember_created_at    | datetime         | YES  |     | NULL                |                |
| reset_password_token   | varchar(255)     | YES  |     | NULL                |                |
| sign_in_count          | int(11)          | YES  |     | 0                   |                |
| current_sign_in_at     | datetime         | YES  |     | NULL                |                |
| last_sign_in_at        | datetime         | YES  |     | NULL                |                |
| current_sign_in_ip     | varchar(255)     | YES  |     | NULL                |                |
| last_sign_in_ip        | varchar(255)     | YES  |     | NULL                |                |
| favorites_count        | int(11)          | YES  | MUL | 0                   |                |
| accept_notes           | int(11)          | YES  |     | 1                   |                |
| notes_count            | int(11)          | YES  | MUL | 0                   |                |
| id                     | int(10) unsigned | NO   | PRI | NULL                | auto_increment |
| per_page_count         | int(11)          | YES  | MUL | 25                  |                |
| name                   | varchar(50)      | YES  |     | NULL                |                |
| timezone               | varchar(50)      | YES  |     | UTC                 |                |
| admin                  | tinyint(1)       | YES  |     | 0                   |                |
| enabled                | tinyint(1)       | YES  |     | 1                   |                |
| gravatar               | tinyint(1)       | YES  |     | 0                   |                |
| created_at             | datetime         | NO   |     | NULL                |                |
| updated_at             | datetime         | NO   |     | NULL                |                |
| avatar_file_name       | varchar(255)     | YES  |     | NULL                |                |
| avatar_content_type    | varchar(255)     | YES  |     | NULL                |                |
| avatar_file_size       | int(11)          | YES  |     | NULL                |                |
| avatar_updated_at      | datetime         | YES  |     | NULL                |                |
| online                 | tinyint(1)       | YES  |     | 0                   |                |
| last_daily_report_at   | datetime         | YES  |     | 2013-12-27 20:43:59 |                |
| last_weekly_report_at  | int(11)          | YES  |     | 201351              |                |
| last_monthly_report_at | int(11)          | YES  |     | 201312              |                |
| last_email_report_at   | datetime         | YES  |     | NULL                |                |
| email_reports          | tinyint(1)       | YES  |     | 0                   |                |
+------------------------+------------------+------+-----+---------------------+----------------+

Back to Snorby E-Book

Clone this wiki locally