{"id":299,"date":"2016-12-26T22:59:18","date_gmt":"2016-12-26T22:59:18","guid":{"rendered":"http:\/\/elmig.debianpt.org\/blog\/?p=299"},"modified":"2016-12-26T22:59:18","modified_gmt":"2016-12-26T22:59:18","slug":"create-root-user-on-gitlab-when-you-cant-define-roots-password","status":"publish","type":"post","link":"https:\/\/elmig.debianpt.org\/blog\/?p=299","title":{"rendered":"Create root user on Gitlab, when you can&#8217;t define root&#8217;s password"},"content":{"rendered":"<p>When Gitlab it&#8217;s installed, the first access to the site allows you to define the password for the root (administrative) account.<\/p>\n<p>But due to a bug\/error when I installed it on Debian testing (Stretch) i always git the standard registration box, not for root.<\/p>\n<p>Googling, i found i was not the only one bitten by the bug\/error.<\/p>\n<p>I was decided to test it on a Debian VM so here it&#8217;s what I have did:<\/p>\n<ul>\n<li>Enter the rails console:<\/li>\n<\/ul>\n<pre>sudo -u gitlab -H bundle exec rails console production<\/pre>\n<ul>\n<li>Create root user on rails:<\/li>\n<\/ul>\n<p><code>user = User.create!(:email=&gt;'root@gitlab.home',:username=&gt;'root',:password=&gt;'x',\u00a0:password_confirmation=&gt;'x',\u00a0:name=&gt;'root')<\/code><\/p>\n<p><code>user = User.where(name: 'root').first<\/code><\/p>\n<p><code>user.update_attribute\u00a0:admin, true <\/code><\/p>\n<p><code>user.save<\/code><\/p>\n<ul>\n<li>Restart gitlab<\/li>\n<\/ul>\n<p><code>service gitlab restart<\/code><\/p>\n<p>And it&#8217;s done. Now login in Gitlab and you can access as root.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When Gitlab it&#8217;s installed, the first access to the site allows you to define the password for the root (administrative) account. But due to a bug\/error when I installed it on Debian testing (Stretch) i always git the standard registration box, not for root. Googling, i found i was not the only one bitten by [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[44],"tags":[45,46,47,42],"class_list":["post-299","post","type-post","status-publish","format-standard","hentry","category-sysadmin","tag-git","tag-gitlab","tag-rails","tag-sysadmin"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=299"}],"version-history":[{"count":2,"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/299\/revisions"}],"predecessor-version":[{"id":301,"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/299\/revisions\/301"}],"wp:attachment":[{"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elmig.debianpt.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}