Create a Redmine admin user from CLI

Start a production Rails console:

cd /opt/my/path/to/redmine
bundle exec rails c production

In the console:

u=User.new(login: 'newadmin', admin: true, 
mail: '[email protected]', 
firstname:'Redmine' , lastname:'Admin')

#password cannot be mass assigned so it needs to be specified separately
u.password='newpassword' 

u.save

=> true #true means the creation was successful

In case save failed:

u.errors.messages #Displays saving errors

 

Leave a Reply