Capistrano 3 sudo task

前端 未结 5 1459
被撕碎了的回忆
被撕碎了的回忆 2021-02-01 15:48

I want to write a recipe with Capistrano 3 executing a task on the remote server with sudo.

With Capistrano 2 this could be done for example:

default_run         


        
5条回答
  •  借酒劲吻你
    2021-02-01 16:10

    The Capistrano 3 guide recommends the use of passwordless sudo. This allows your less-priveleged user execute the sudo command without having to enter a password via the PTY.

    You can use the task that Kentaro wrote above, and add something like the following to your /etc/sudoers file:

    deploy ALL=NOPASSWD:/bin/cp ~/something /something
    

    http://www.capistranorb.com/documentation/getting-started/authentication-and-authorisation/#toc_8

提交回复
热议问题