scp: localhost 비밀번호가 허용되지 않습니다.

scp: localhost 비밀번호가 허용되지 않습니다.

공개 키를 원격 서버에 복사하려고 합니다. 저는 [localname]으로 로컬에 로그인했고 키는 local 입니다 ~/.ssh/. 또한 [remotename]으로 [remote.com]에 SSH를 통해 접속하고 다음과 같이 키를 업로드해 보았습니다.

scp [localname]@localhost:~/.ssh/id_rsa.pub [remotename]@[remote.com]:/home/[remotename]/.ssh/uploaded_key.pub

[remote.com]에서 환영 메시지가 표시되지만 다음과 같은 질문이 표시됩니다.

[localuser]@localhost's password:

그러나 [localuser]의 비밀번호([localuser]가 로컬 컴퓨터에 로그인하는 데 사용하는 비밀번호)는 허용되지 않습니다.

Permission denied, please try again.

자세한 출력은 다음과 같습니다.

Executing: /usr/bin/ssh '-v' '-x' '-oClearAllForwardings yes' '-n' '-l' '[localname]' 'localhost' 'scp -v' '~/.ssh/id_rsa.pub' '[remotename]@[remote.com]:/home/[remotename]/.ssh/uploaded_key.pub'
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/[remotename]/.ssh/identity type -1
debug1: identity file /home/[remotename]/.ssh/id_rsa type -1
debug1: identity file /home/[remotename]/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7
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: Host 'localhost' is known and matches the RSA host key.
debug1: Found key in /home/[remotename]/.ssh/known_hosts:5
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

  *****************************************
  ** This is [remote.com] server **
  **  Unauthorized access is PROHIBITED  **
  *****************************************

debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/[remotename]/.ssh/identity
debug1: Trying private key: /home/[remotename]/.ssh/id_rsa
debug1: Trying private key: /home/[remotename]/.ssh/id_dsa
debug1: Next authentication method: password
[localname]@localhost's password: 
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
[localname]@localhost's password:

이것이 scp의 올바른 사용법인지 확인하거나 문제 해결 팁을 제공할 수 있는 사람이 있습니까?

로컬 호스트: Mac OS X 10.6.8의 터미널 2.1.2 원격: Ubuntu 10.04 |

답변1

이것은 지나치게 복잡해 보입니다. 다음을 사용해 보세요 localhost.

scp ~/.ssh/id_rsa.pub [remotename]@[remote.com]:.ssh/uploaded_key.pub

답변2

흥미로운 질문입니다. 방금 같은 것을 시도했지만 같은 오류가 발생했습니다. 나는 -vvv뒤에서 무슨 일이 일어나고 있는지 파악하기 위해 스위치를 사용했습니다. 기본적으로 SSH를 통해 로컬 호스트에 연결하고 실행합니다.scp -v ~/.ssh/id_rsa.pub remoteuser@remoteserver:~/

하지만 이 방법은 제대로 작동할 것입니다.이 명령은 stdin에서 비밀번호를 읽으려고 시도하지만 제어 tty가 없으면 비밀번호가 없으므로 권한 거부 메시지가 나타납니다.

내 요점을 설명하는 단순화된 디버깅 버전은 다음과 같습니다.

debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
dpac@localhost's password: 
debug3: packet_send2: adding 64 (len 60 padlen 4 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
.
.
.

debug1: Sending command: scp -v ~/.ssh/id_rsa.pub REMOTEUSER@REMOTESERVER:~/
debug2: channel 1: request exec confirm 1
debug2: callback done
debug2: channel 1: open confirm rwindow 0 rmax 32768
debug2: channel 1: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 1
debug2: exec request accepted on channel 1
debug2: channel 1: read<=0 rfd 5 len 0
debug2: channel 1: read failed
debug2: channel 1: close_read
debug2: channel 1: input open -> drain
debug2: channel 1: ibuf empty
debug2: channel 1: send eof
debug2: channel 1: input drain -> closed
debug2: channel 1: rcvd ext data 92
Executing: program /usr/bin/ssh host REMOTESERVER, user REMOTEUSER, command scp -v -t -- ~/
debug2: channel 1: written 92 to efd 7
debug2: channel 1: rcvd ext data 57
.
.
.
.
.

debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/dpac/.ssh/id_rsa
debug1: Trying private key: /home/dpac/.ssh/id_dsa
debug2: channel 1: written 214 to efd 7
debug2: channel 1: rcvd ext data 100
debug2: channel 1: rcvd ext data 73
debug1: Trying private key: /home/dpac/.ssh/id_ecdsa
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug2: channel 1: written 173 to efd 7
debug2: channel 1: rcvd ext data 174
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
debug2: channel 1: written 174 to efd 7
debug2: channel 1: rcvd ext data 101
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug2: channel 1: written 101 to efd 7
debug2: channel 1: rcvd ext data 73
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug2: channel 1: written 73 to efd 7
debug2: channel 1: rcvd ext data 152
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).

답변3

scp지금까지 소스와 대상에 대해 "원격" 사양 사용을 지원하는 버전 을 찾지 못했습니다 .

관련 정보