lua-resty-shell
lua-resty-shell copied to clipboard
exec ssh cmd can't open /dev/tty
my lua code:
local ok, stdout, stderr, reason, status=shell.run([[ls -la /dev/tty && ssh -v [email protected] 'pwd']])
stdout:
crw-rw-rw- 1 root root 5, 0 Jan 26 10:03 /dev/tty
stderr:
OpenSSH_7.6p1 Ubuntu-4ubuntu0.4, OpenSSL 1.0.2n 7 Dec 2017\13\ debug1: Reading configuration data /etc/ssh/ssh_config\13\ debug1: Connecting to 10.242.19.149 [10.242.19.149] port 22.\13\ debug1: Connection established.\13\ debug1: permanently_set_uid: 0/0\13\ debug1: identity file /root/.ssh/id_rsa type 0\13\ debug1: key_load_public: No such file or directory\13\ debug1: identity file /root/.ssh/id_rsa-cert type -1\13\ debug1: key_load_public: No such file or directory\13\ debug1: identity file /root/.ssh/id_dsa type -1\13\ debug1: key_load_public: No such file or directory\13\ debug1: identity file /root/.ssh/id_dsa-cert type -1\13\ debug1: key_load_public: No such file or directory\13\ debug1: identity file /root/.ssh/id_ecdsa type -1\13\ debug1: key_load_public: No such file or directory\13\ debug1: identity file /root/.ssh/id_ecdsa-cert type -1\13\ debug1: key_load_public: No such file or directory\13\ debug1: identity file /root/.ssh/id_ed25519 type -1\13\ debug1: key_load_public: No such file or directory\13\ debug1: identity file /root/.ssh/id_ed25519-cert type -1\13\ debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.4\13\ debug1: Remote protocol version 2.0, remote software version OpenSSH_8.3\13\ debug1: match: OpenSSH_8.3 pat OpenSSH* compat 0x04000000\13\ debug1: Authenticating to 10.242.19.149:22 as 'ecs'\13\ debug1: SSH2_MSG_KEXINIT sent\13\ debug1: SSH2_MSG_KEXINIT received\13\ debug1: kex: algorithm: curve25519-sha256\13\ debug1: kex: host key algorithm: ecdsa-sha2-nistp256\13\ debug1: kex: server->client cipher: aes128-ctr MAC: [email protected] compression: none\13\ debug1: kex: client->server cipher: aes128-ctr MAC: [email protected] compression: none\13\ debug1: expecting SSH2_MSG_KEX_ECDH_REPLY\13\ debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Q9Mt2lHfjuOyBtpwR5nJAF62bntiFA9L4bIln4WS570\13\ debug1: Host '10.242.19.149' is known and matches the ECDSA host key.\13\ debug1: Found key in /root/.ssh/known_hosts:4\13\ debug1: rekey after 4294967296 blocks\13\ debug1: SSH2_MSG_NEWKEYS sent\13\ debug1: expecting SSH2_MSG_NEWKEYS\13\ debug1: SSH2_MSG_NEWKEYS received\13\ debug1: rekey after 4294967296 blocks\13\ debug1: SSH2_MSG_EXT_INFO received\13\ debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>\13\ debug1: SSH2_MSG_SERVICE_ACCEPT received\13\ Authorized only. All activity will be monitored and reported \ debug1: Authentications that can continue: publickey,password\13\ debug1: Next authentication method: publickey\13\ debug1: Offering public key: RSA SHA256:bHTPC4YQ1nZ/BgIHH3g/ndanAPWvvRD9WyDmUD9buxM /root/.ssh/id_rsa\13\ debug1: Authentications that can continue: publickey,password\13\ debug1: Trying private key: /root/.ssh/id_dsa\13\ debug1: Trying private key: /root/.ssh/id_ecdsa\13\ debug1: Trying private key: /root/.ssh/id_ed25519\13\ debug1: Next authentication method: password\13\ debug1: read_passphrase: can't open /dev/tty: No such device or address\13\ debug1: Authentications that can continue: publickey,password\13\ Permission denied, please try again.\13\ debug1: read_passphrase: can't open /dev/tty: No such device or address\13\ debug1: Authentications that can continue: publickey,password\13\ Permission denied, please try again.\13\ debug1: read_passphrase: can't open /dev/tty: No such device or address\13\ debug1: Authentications that can continue: publickey,password\13\ debug1: No more authentication methods to try.\13\ [email protected]: Permission denied (publickey,password).\13\
/dev/tty is exist but ssh can't open