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

おすすめ記事