Gitlab重置root密码

945次阅读
没有评论

共计 3327 个字符,预计需要花费 9 分钟才能阅读完成。

Gitlab重置root密码

瞎倒腾会,o( ̄┰ ̄*)ゞ

Gitlab重置root密码

查看下服务状态

[root@ks-gitlab ~]# gitlab-ctl status
run: alertmanager: (pid 18334) 537s; run: log: (pid 1241) 104443s
run: gitaly: (pid 1226) 104443s; run: log: (pid 1219) 104443s
run: gitlab-exporter: (pid 1232) 104443s; run: log: (pid 1231) 104443s
run: gitlab-workhorse: (pid 1227) 104443s; run: log: (pid 1221) 104443s
run: grafana: (pid 15067) 2118s; run: log: (pid 1243) 104443s
run: logrotate: (pid 19064) 42s; run: log: (pid 1235) 104443s
run: nginx: (pid 17113) 1365s; run: log: (pid 1217) 104443s
run: node-exporter: (pid 1250) 104443s; run: log: (pid 1240) 104443s
run: postgres-exporter: (pid 1253) 104443s; run: log: (pid 1244) 104443s
run: postgresql: (pid 1230) 104443s; run: log: (pid 1229) 104443s
run: prometheus: (pid 1237) 104443s; run: log: (pid 1236) 104443s
run: puma: (pid 18307) 551s; run: log: (pid 1233) 104443s
run: redis: (pid 1224) 104443s; run: log: (pid 1211) 104443s
run: redis-exporter: (pid 1228) 104443s; run: log: (pid 1225) 104443s
run: sidekiq: (pid 18278) 558s; run: log: (pid 1234) 104443s

# 没毛病

进入gitlab-rails终端

[root@ks-gitlab ~]# gitlab-rails console
--------------------------------------------------------------------------------
 GitLab:       13.2.9 (d43bc5ce99e) FOSS
 GitLab Shell: 13.3.0
 PostgreSQL:   11.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.1)
irb(main):001:0> 

重置root密码

[root@ks-gitlab ~]# gitlab-rails console
--------------------------------------------------------------------------------
 GitLab:       13.2.9 (d43bc5ce99e) FOSS
 GitLab Shell: 13.3.0
 PostgreSQL:   11.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.1)
irb(main):001:0> 
irb(main):002:0> User.where(id: 1).first
=> #<User id:1 @root>
irb(main):003:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):004:0> user.password=12345678
=> 12345678
irb(main):005:0> user.password
user.password                                        user.password_automatically_set_change_to_be_saved   user.password_digest                                 user.password_expires_at_change_to_be_saved
user.password=                                       user.password_automatically_set_changed?             user.password_expired?                               user.password_expires_at_changed?
user.password_automatically_set                      user.password_automatically_set_in_database          user.password_expires_at                             user.password_expires_at_in_database
user.password_automatically_set=                     user.password_automatically_set_previous_change      user.password_expires_at=                            user.password_expires_at_previous_change
user.password_automatically_set?                     user.password_automatically_set_previously_changed?  user.password_expires_at?                            user.password_expires_at_previously_changed?
user.password_automatically_set_before_last_save     user.password_automatically_set_was                  user.password_expires_at_before_last_save            user.password_expires_at_was
user.password_automatically_set_before_type_cast     user.password_automatically_set_will_change!         user.password_expires_at_before_type_cast            user.password_expires_at_will_change!
user.password_automatically_set_came_from_user?      user.password_confirmation                           user.password_expires_at_came_from_user?             user.password_required?
user.password_automatically_set_change               user.password_confirmation=                          user.password_expires_at_change                      
irb(main):005:0> user.password_confirmation=12345678
=> 12345678
irb(main):006:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: f474a3ea-4953-4710-976e-10e5f576c4cf) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f6096b72048 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):007:0> exit
[root@ks-gitlab ~]#

正文完
 
xadocker
版权声明:本站原创文章,由 xadocker 2020-01-13发表,共计3327字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)