当提示输入 Ubuntu 盒子的 SUDO 密码时,Capistrano 挂起

发布于 2024-07-12 06:40:38 字数 286 浏览 2 评论 0原文

我有一个 capistrano 部署配方,我已经使用了一段时间来部署我的 Web 应用程序,然后使用 sudo 命令重新启动 apache/nginx。 最近,当我尝试执行这些 sudo 命令时,cap 部署挂起。 我看到输出: “[sudo] 的密码” 使用我的服务器名称和远程登录,但这不是安全登录提示。 cap shell 只是挂起等待更多输出,并且不允许我输入密码来完成远程 sudo 命令。

有没有办法解决这个问题或解决这个问题? 我不想删除远程用户的 Web 重新启动命令的 sudo 密码提示。

I have a capistrano deployment recipe I've been using for some time to deploy my web app and then restart apache/nginx using the sudo command. Recently cap deploy is hanging when I try to execute these sudo commands. I see the output:
"[sudo] password for "
With my server name and the remote login, but this is not a secure login prompt. The cap shell is just hanging waiting for more output and does not allow me to type my password in to complete the remote sudo command.

Is there a way to fix this or a decent work around? I did not want to remove the sudo password prompt of my remote user for web restart commands.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浪菊怪哟 2024-07-19 06:40:38

连接到 CentOS 机器时似乎也会发生这种情况。 在您的 capistrano 部署文件中添加以下行:

default_run_options[:pty] = true

另外,请确保使用 sudo 帮助程序,而不是直接在运行命令中执行 sudo。 例如:

# not
run "sudo chown root:root /etc/my.cnf"

# but
sudo "chown root:root /etc/my.cnf"

This seems to happen when connecting to CentOS machines as well. Add the following line in your capistrano deploy file:

default_run_options[:pty] = true

Also make sure to use the sudo helper instead of executing sudo in your run commands directly. For example:

# not
run "sudo chown root:root /etc/my.cnf"

# but
sudo "chown root:root /etc/my.cnf"
Smile简单爱 2024-07-19 06:40:38

其他建议可能是合理的,但我发现一旦更新到 Capistrano 2.5.3 问题就消失了。 我必须确保停止运行操作系统附带的默认版本的工具。

The other advice may be sound, but I found that once I updated to Capistrano 2.5.3 the problem went away. I have to make sure I stop running the default versions of tools that came with my O/S.

西瓜 2024-07-19 06:40:38
# prevent sudo prompting for password
set :sudo_prompt, ""
# prevent sudo prompting for password
set :sudo_prompt, ""
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文