Permanently switching user in Capistrano 3 (separate authorization & deploy)

后端 未结 1 909
故里飘歌
故里飘歌 2021-01-17 22:47

We have following pattern in server management - all users do have their own user, but deploy is fully performed by special deploy user, without direct login possibility.

相关标签:
1条回答
  • 2021-01-17 23:24

    Since I had received no proper answer and didn't got the idea myself, I decided to ask authors. Capistrano 3.x uses SSHKit to manage remote execution commands, and here's their answer:

    You could try overriding the command map such that every command gets prefixed with the desired sudo string. https://github.com/capistrano/sshkit/blob/master/README.md#the-command-map

    SSHKit.config.command_map = Hash.new do |hash, command|
      hash[command] = "<<sudo stuff goes here>> #{command}"
    end
    

    The documentation says "this may not be wise, but it would be possible". YMMV

    0 讨论(0)
提交回复
热议问题