搞乱了 gitlab 权限,现在不知道该怎么办

and*_*ich 2 gitlab

我试图让我的 gitlab-runner 工作,但我把我的 gitlab 配置弄得非常糟糕......我希望可以恢复我的自托管 gitlab 实例。

首先,当我运行时,sudo gitlab-ctl status我得到输出

down: alertmanager: 1s, normally up, want up; run: log: (pid 8770) 1438s
down: prometheus: 0s, normally up, want up; run: log: (pid 8742) 1438s
Run Code Online (Sandbox Code Playgroud)

其余部分按我猜测的方式工作。正如我之前所说,由于配置混乱,导致权限被拒绝错误相关的问题sudo chown ...

有没有办法恢复旧的用户权限?或者有没有办法获取gitlab所需的权限配置信息?

非常感谢!

PS:当我运行时sudo gitlab-ctl reconfigure出现此错误

 ================================================================================
    Error executing action `run` on resource 'execute[/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions ----
    STDOUT: error: could not open /var/opt/gitlab/.ssh/authorized_keys: Permission denied @ rb_sysopen - /var/opt/gitlab/.ssh/authorized_keys
    -rw------- 1 gitlab-redis git 1948 Apr 23 15:33 /var/opt/gitlab/.ssh/authorized_keys
    STDERR: 
    ---- End output of /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions ----
    Ran /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions returned 1

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/gitlab-shell.rb

     85: execute "#{gitlab_shell_keys_check} check-permissions" do
     86:   user git_user
     87:   group git_group
     88: end
     89: 

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/gitlab-shell.rb:85:in `from_file'

    execute("/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions") do
      action [:run]
      default_guard_interpreter :execute
      command "/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions"
      backup 5
      group "git"
      returns 0
      user "git"
      declared_type :execute
      cookbook_name "gitlab"
      recipe_name "gitlab-shell"
      domain nil
    end

    System Info:
    ------------
    chef_version=13.6.4
    platform=ubuntu
    platform_version=18.04
    ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/chef-client
    executable=/opt/gitlab/embedded/bin/chef-client


Running handlers:
There was an error running gitlab-ctl reconfigure:

execute[/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions] (gitlab::gitlab-shell line 85) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions ----
STDOUT: error: could not open /var/opt/gitlab/.ssh/authorized_keys: Permission denied @ rb_sysopen - /var/opt/gitlab/.ssh/authorized_keys
-rw------- 1 gitlab-redis git 1948 Apr 23 15:33 /var/opt/gitlab/.ssh/authorized_keys
STDERR: 
---- End output of /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions ----
Ran /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions returned 1
Run Code Online (Sandbox Code Playgroud)

MrR*_*ing 5

我认为您正在使用 GitLab Omnibus!如果是这样,请下载正确版本的更新权限(您的 GtiLab 实例版本)并运行脚本文件。
它可以解决更改 UID/GID 以及更改文件和目录的所有权/权限时的权限问题。

注意:使用此脚本时要小心。需要root权限执行!因此,在运行之前请阅读所有文件,并确保您使用的是正确的版本。