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

时间:2019-04-24 11:14:32

标签: 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

其余部分都可以正常运行。如前所述,与权限拒绝有关的问题是由于使用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

1 个答案:

答案 0 :(得分:1)

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

注意:请谨慎使用此脚本。它应该以root权限执行!因此请在运行前阅读所有文件,并确保使用正确的版本。