提示输入SUDO密码到Ubuntu机器时,Capistrano挂起 [英] Capistrano is hanging when prompting for SUDO password to an Ubuntu box

查看:80
本文介绍了提示输入SUDO密码到Ubuntu机器时,Capistrano挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段时间使用的capistrano部署配方,用于部署我的Web应用程序,然后使用sudo命令重新启动apache / nginx。最近,当我尝试执行这些sudo命令时,cap deploy挂起。我看到输出:

的[sudo]密码使用我的服务器名和远程登录名,但这不是安全的登录提示。帽壳只是挂起来等待更多输出,并且不允许我输入密码来完成远程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.

是否可以解决此问题?体面的工作?我不想删除远程用户的sudo密码提示以执行Web重新启动命令。

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.

推荐答案

这似乎在连接时发生以及CentOS机器。在capistrano部署文件中添加以下行:

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

也请确保使用 sudo 助手而不是执行 sudo 直接在您的运行命令中。例如:

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"

这篇关于提示输入SUDO密码到Ubuntu机器时,Capistrano挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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