当前位置: 首页 > 知识库问答 >
问题:

nohup导致“读取密码:无法打开/dev/tty”

云新知
2023-03-14

我有一个简单的远程ssh脚本命令nohupssh。嘘

sleep 30
ssh -v  -l developer server11  "/usr/local/jdk1.7.0_45/bin/jmap -histo:live 1770;"

我按如下方式运行脚本:

nohup nohupssh.sh > out.log 2>&1 & 

当我如上所示执行它时,jmap实用程序在远程服务器上成功执行。但是,如果按照上面所示执行它并退出bashshell,则会出现如下所示的错误。

请注意,我在本地和远程服务器上都有一个正确格式化的authorized_keys。另外请注意,由于这两个服务器是共享的,所以这两个服务器都没有id_rsa。

我试过很多组合:

ssh -v -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null server11 .... 

但是没有用。我仔细检查了ssh的手册页,寻找线索,尝试了各种选择。我认为必须有一个或一组ssh选项来解决这个问题。真正的脚本(而不是上面的节略)也有scp。因此,我希望我所回避的选项对scp和ssh都有效。

完整的详细日志

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /home/developer/.ssh/config
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to server11 [10.255.10.20] port 22.
debug1: fd 4 clearing O_NONBLOCK
debug1: Connection established.
debug1: identity file /home/developer/.ssh/identity type -1
debug1: identity file /home/developer/.ssh/id_rsa type -1
debug1: identity file /home/developer/.ssh/id_dsa type -1
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
Warning: Permanently added 'server11,10.255.10.20' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
****************************************************************************
WARNING: Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that your
actions may be monitored.
****************************************************************************


debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/developer/.ssh/identity
debug1: Trying private key: /home/developer/.ssh/id_rsa
debug1: Trying private key: /home/developer/.ssh/id_dsa
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
ssh_askpass: exec(/usr/libexec/openssh/ssh-askpass): No such file or directory
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
ssh_askpass: exec(/usr/libexec/openssh/ssh-askpass): No such file or directory
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
ssh_askpass: exec(/usr/libexec/openssh/ssh-askpass): No such file or directory
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).

共有2个答案

岳毅
2023-03-14

我有这个read_passphrase:当我的私钥被错误地格式化时,无法打开 /dev/tty错误-而不是许多行,它是作为一行程序传递的,并且您可能有任何其他格式问题,如开始时忘记的"-"结束,或者行尾有错误,比如缺少换行符格式或行尾有一个附加字母。

请参阅Dockerfile:clone repo with passwordless private key。错误:“authentication agent”或“read_passphrase:can't open/dev/tty”了解更多详细信息,其主要思想是在docker文件中向ssh代理添加私钥,这同样是Gitlab CI/docker的思想:ssh Add不断请求密码。

胡沈义
2023-03-14

从错误日志:

可以继续的身份验证:公钥、密码

由于您没有公钥设置(“没有id_rsa”),因此需要输入密码才能访问远程服务器,但您已断开了stdin:

读取\u密码:无法打开/dev/tty:没有这样的设备或地址

SSH不太适合黑客自动输入密码,因此如果您不能在上面放置id_rsa,最好的办法是在输入远程服务器的密码后进行后台处理并分离。试试^Z:

  1. 运行nohup nohupssh。嘘

 类似资料:
  • 问题内容: 在充气城堡的示例中,我找到了以下代码: 当我使用此代码编写p12时,我尝试使用openssl或钥匙串将其打开,并提示我输入密码。我用他们的密码 尝试打开P12,但是它不起作用。此外,当我按原样运行此主要功能时,将执行此行 为了正确地在p12上输入密码,他们的示例有问题吗?我基本上是想做相当于 如果有其他想法,也可以使用Bouncy Castle在Java中使用。 编辑 看NISTObj

  • 本文向大家介绍今win10更新导致VMware workstation pro无法打开的解决方法,包括了今win10更新导致VMware workstation pro无法打开的解决方法的使用技巧和注意事项,需要的朋友参考一下 今天晚上吃完饭回来打开笔记本的时候就遇到问题了,一般睡眠的机子按回车或者启动键就可以正常进入桌面了,但是今天很奇怪久久打不开桌面,然后只能无奈长按重启,然后就配置更新了,起

  • 我的docker已经有了我在Job.Yaml中使用的图像,但minikube失败了 这是我的job.yaml文件 docker图像 谁能指导一下我缺少什么吗?任何特定的设置我需要做的注册表部分?

  • 问题内容: 我是Linux Mint用户,正在处理Arduino Yun,正在编译Arduino程序,之后上传到Arduino Yun,然后我得到这些错误,您能帮我吗? 问题答案: 你 首先 需要确保您有正确的读/写权限,如所描述这里,esentially输入以下命令: “ / dev / ttyACM0”是您的arduino连接到的端口,它应该在根目录的/ dev文件夹中列出。 第二: 在确定了

  • 我已经使用命令重置了DEV\u OAM和DEV\u OPSS密码 密码重置后,我尝试重新启动Weblogic Admin Server和Oam托管服务器。当我尝试重新启动管理服务器时,我遇到了以下错误。 内部异常:java.sql.SQLException: ORA-01017:无效的用户名/密码;登录被拒绝 错误代码:1017 2015年2月20日10:58:08 PM oracle。安全jps

  • 问题内容: 情况: 读取偶尔会出现错误号-11:资源暂时不可用。 什么时候会出现此错误?看起来非常罕见,因为常见情况会返回数据: 如果没有写入器打开了管道,则返回空的str(’‘)。 如果编写器打开了管道,但FIFO中没有数据,则还返回空的str(’‘) 当然,如果编写者将数据放入fifo,则将读取该数据。 问题答案: 从系统调用的POSIX规范(强调我的): 尝试从空管道或FIFO中读取时: 如