nohup 악마 배경에서 실행하는 경우에만 너무 많은 인증 실패로 인해 SSH가 실패함

nohup 악마 배경에서 실행하는 경우에만 너무 많은 인증 실패로 인해 SSH가 실패함

원격 유닉스 서버에서 ssh 명령을 실행하고 출력을 변수에 저장하고 변수를 인쇄하는 다음 스크립트가 있습니다.

()를 사용하여 전경이나 배경에서 실행하면 세션이 활성 상태인 한 스크립트가 제대로 실행되지만 nohup ./script &세션을 종료하면 "인증 실패 가능성이 너무 높습니다"라는 메시지와 함께 실패합니다.

확인해 보니 ps -ef | grep script백그라운드 프로세스가 /dev/pts1 터미널에 할당되어 있고 이제 "?"가 표시됩니다. 이것은 악마적인 프로세스입니다.

ssh -n 또는 -f 옵션을 확인했지만 동일한 문제가 발생했습니다. SSH 명령은 자동 비밀번호로 실행됩니다.

스크립트: (다음으로 명령을 실행합니다 nohup ./script.sh > script.log 2>&1 &)

#!/usr/bin/ksh
while ture;
do    
x=`ssh username@remote_server "ls -l /dir1/dir2/*|wc -l"`    
echo "the count is $x"    
sleep 2m    
done

그 후 ssh -v 옵션을 사용하여 캡처를 시도했는데 실패한 출력을 찾아보십시오. 나는 /dev/tty를 찾을 수 없다는 것을 알았습니다. nohup &를 실행하는 세션을 종료했기 때문에 악마 프로세스에 할당되어 터미널이 없기 때문인 것 같습니다.

debug1: Host 'username' is known and matches the DSA host key.
debug1: Found key in /home/.ssh/known_hosts:15
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/.ssh/id_rsa --------here it was like Offering RSA public key: local_user_name
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/.ssh/id_dsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/.ssh/id_ecdsa
debug1: Trying private key: /home/.ssh/id_ed25519
debug1: Next authentication method: keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
Received disconnect from remote_IP_address:2: Too many authentication failures
Authentication failed.

성공 로그의 요청에 따라 여기에서 편집하십시오.

nohup: ignoring input
OpenSSH_7.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to remote_server [remoteserver_ip] port 22.
debug1: Connection established.
debug1: identity file /home/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2
debug1: match: OpenSSH_7.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to remote_server:22 as 'remote_server_user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-dss
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: kex: [email protected] need=20 dh_need=20
debug1: kex: [email protected] need=20 dh_need=20
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-dss SHA256some_key_goes_here
debug1: Host 'remote_server' is known and matches the DSA host key.
debug1: Found key in /home/.ssh/known_hosts:15
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: MY_user_id
debug1: Server accepts key: pkalg rsa-sha2-512 blen 533
debug1: Authentication succeeded (publickey).
Authenticated to remote_server ([remote_server_ip]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = C
debug1: Sending command: MY COMMAND HERE
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 3784, received 2544 bytes, in 0.1 seconds
Bytes per second: sent 37022.5, received 24890.4
debug1: Exit status 0

이 문제를 해결하는 방법을 알려주십시오. 이 문제에 대한 해결책을 제공하기 위해 추가 정보가 필요한 경우 알려주십시오. 로컬 서버: GNU Linux

원격 서버: sunSolaris

관련 정보