- 论坛徽章:
- 0
|
大家好,有个问题实在搞不定,请教一下。
我想在一台A机器上执行脚本 install_st_remote,这个脚本可以带一个参数是另外一台机器的IP,暂且是B,脚本的作用是在XYZ上下载软件进行安装到这台IP的机器上。- > more install_st_local
- #!/bin/bash
- ST_INSTALLER_PATH="/install/st/"
- ST_PATH="/usr/QE/st"
- #download tarball
- echo "##########################"
- echo "Downloading teperl tarball"
- mkdir -p $ST_INSTALLER_PATH
- scp -r -v mike@XYZ:/net/st-linux_x64.tar $ST_INSTALLER_PATH
- #extract it
- echo "##########################"
- echo "Extracting it to $ST_PATH"
- mkdir -p $TEPERL_PATH
- cd $ST_INSTALLER_PATH && tar -xvf st-linux_x64.tar -C $ST_PATH
复制代码 这个install_st_local脚本在B上执行是没问题的,执行到scp的时候会提示输入密码,然后就能继续。
但是我如果在A上执行(通过另外的脚本install_st_remote调用):- > more install_st_remote
- #!/bin/bash
- REMOTE_USER=root
- REMOTE_HOSTNAME=$1
- ssh -l $REMOTE_USER $REMOTE_HOSTNAME 'bash -s' < ./install_st_local
复制代码 但是结果是在scp那里就不提示输入密码,直接验证失败报错。- [root@i122-eng175 install]# ./install_st_remote 10.17.39.90
- ##########################
- Downloading st tarball
- Executing: program /usr/bin/ssh host XYZ, user mike, command scp -v -r -f /net/st-linux_x64.tar
- OpenSSH_6.2p2, OpenSSL 0.9.8j-fips 07 Jan 2009
- debug1: Reading configuration data /etc/ssh/ssh_config
- debug1: /etc/ssh/ssh_config line 20: Applying options for *
- debug1: Connecting to XYZ port 22.
- debug1: Connection established.
- debug1: permanently_set_uid: 0/0
- debug1: identity file /root/.ssh/id_rsa type 1
- debug1: identity file /root/.ssh/id_rsa-cert type -1
- debug1: identity file /root/.ssh/id_dsa type -1
- debug1: identity file /root/.ssh/id_dsa-cert type -1
- debug1: identity file /root/.ssh/id_ecdsa type -1
- debug1: identity file /root/.ssh/id_ecdsa-cert type -1
- debug1: Enabling compatibility mode for protocol 2.0
- debug1: Local version string SSH-2.0-OpenSSH_6.2
- debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1.2
- debug1: no match: Sun_SSH_1.1.2
- 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
- debug1: Server host key: RSA ff:aa:0c:0f:2d:fc:b5:53:f7:9b:d2:23:2b:c4:47:30 [MD5]
- debug1: Host 'XYZ' is known and matches the RSA host key.
- debug1: Found key in /root/.ssh/known_hosts:4
- debug1: ssh_rsa_verify: signature correct
- debug1: SSH2_MSG_NEWKEYS sent
- debug1: expecting SSH2_MSG_NEWKEYS
- debug1: SSH2_MSG_NEWKEYS received
- debug1: Roaming not allowed by server
- debug1: SSH2_MSG_SERVICE_REQUEST sent
- debug1: SSH2_MSG_SERVICE_ACCEPT received
- debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
- debug1: Next authentication method: publickey
- debug1: Offering RSA public key: /root/.ssh/id_rsa
- debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
- debug1: Trying private key: /root/.ssh/id_dsa
- debug1: Trying private key: /root/.ssh/id_ecdsa
- debug1: Next authentication method: keyboard-interactive
- debug1: read_passphrase: can't open /dev/tty: No such device or address
- debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive
- debug1: Next authentication method: keyboard-interactive
- debug1: read_passphrase: can't open /dev/tty: No such device or address
- debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive
- debug1: read_passphrase: can't open /dev/tty: No such device or address
- debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive
- debug1: No more authentication methods to try.
- Permission denied (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive).
- ##########################
- Extracting it to /usr/QE/st
- tar: st-linux_x64.tar: Cannot open: No such file or directory
- tar: Error is not recoverable: exiting now
复制代码 |
|