Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssh nohup原因“;阅读密码短语:can';t open/dev/tty“;_Ssh_Scp_Nohup - Fatal编程技术网

Ssh nohup原因“;阅读密码短语:can';t open/dev/tty“;

Ssh nohup原因“;阅读密码短语:can';t open/dev/tty“;,ssh,scp,nohup,Ssh,Scp,Nohup,我在脚本中有一个简单的远程ssh命令nohupssh.sh 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,则会出现如下

我在脚本中有一个简单的远程ssh命令nohupssh.sh

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,则会出现如下所示的错误

请注意,我在本地和远程服务器中都有一个正确格式化的授权密钥。还请注意,这两台服务器中都没有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).
OpenSSH_4.3p2,OpenSSL 0.9.8e-fips-rhel5 2008年7月1日
debug1:正在读取配置数据/home/developer/.ssh/config
debug1:将选项应用于*
debug1:读取配置数据/etc/ssh/ssh\u config
debug1:将选项应用于*
debug1:连接到服务器11[10.255.10.20]端口22。
调试1:fd 4清除O_非块
debug1:已建立连接。
debug1:identity file/home/developer/.ssh/identity-type-1
debug1:identity file/home/developer/.ssh/id\u rsa type-1
debug1:identity file/home/developer/.ssh/id_dsa type-1
debug1:加载了3个键
debug1:远程协议版本2.0,远程软件版本OpenSSH_4.3
debug1:match:OpenSSH_4.3 pat OpenSSH*
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_4.3
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:server->client aes128 ctr hmac-md5无
debug1:kex:客户端->服务器aes128 ctr hmac-md5无
debug1:SSH2\u MSG\u KEX\u DH\u GEX\u请求(来自错误日志的1024:

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

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

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

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

  • 运行
    nohup nohupssh.sh>out.log 2>&1
  • 等待30秒,然后输入远程服务器密码
  • 击中控制-Z
  • 运行
    bg%1
  • 现在应该可以退出shell了

  • 当我的私钥格式错误时,我有一个
    读取\u密码短语:无法打开/dev/tty
    错误-它不是许多行,而是作为一行传递的,您可能会有任何其他格式问题,比如忘记“-”在开头或结尾,或行尾出现错误,如缺少换行符格式或行尾出现附加字母

    有关更多详细信息,请参阅,其中包含的主要思想来源于,它同样具有来自的思想。

    可能与