Capistrano仅允许使用“ sudo su-user” [英] Capistrano with only 'sudo su - user' allowed

查看:82
本文介绍了Capistrano仅允许使用“ sudo su-user”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将简单的Rails / Capistrano部署到远程服务器。不幸的是,我无法获得 sudo 才能正常运行。我需要在这里部署:

I'm trying to do an uncomplicated Rails/Capistrano deployment to a remote server. Unfortunately I can't get sudo to run correctly out of the box. I need to deploy here:

drwxr-xr-x 2 user   www       4096 Sep 28 15:05 my_app_dir

已经设置了sudoers,以允许我运行 sudo su-用户

and sudoers has been set up to allow me to run sudo su - user and that's it.

有人试图哄骗它从deploy.rb开始工作:

Some attempts to coax this into working from deploy.rb:

set :use_sudo, true
set :sudo, 'sudo su - user'  # fails due to bad su syntax, -c is inserted after user
set :sudo, 'sudo -u user'  # fails because it's not set up
set :sudo, 'sudo su - user -c' # also bad syntax
set :sudo_prompt, ''

我收集的最佳选择之一是:

I gather than the best options are to either:


  1. 启用无密码的 sudo (推荐此处

  2. 启用 sudo -u用户,该版本应与<$ c一起使用$ c> set:sudo,'sudo -u用户'

  1. Enable password-less sudo (recommended here)
  2. Enable sudo -u user, which should work with set :sudo, 'sudo -u user'

有什么方法可以照常进行?

Any ways to make this work as is?

推荐答案

您是您的用户吗?尝试使用添加到服务器上的sudoers cfg?
试试这个

Is your user that you're trying to use added to the sudoers cfg on the server? Try this

run "#{sudo :as => 'bob'} mkdir /path/to/dir"

这篇关于Capistrano仅允许使用“ sudo su-user”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆