誰得なメモ
公開鍵と秘密鍵 を使わないで、ユーザIDとパスワードで認証を行います。
環境
amazon-linux の openssh-clients-6.6.1p1-31.63.amzn1.x86_64
パッケージ。
実行するコマンド
sftp -o PubkeyAuthentication=no {ユーザID}@{接続先サーバ}
確認方法
-v オプションで表示されるデバッグログから確認します。
$ sftp -v -o PubkeyAuthentication=no {ユーザID}@{接続先サーバ}
OpenSSH_6.6.1, OpenSSL 1.0.1k-fips 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to ftp.example.com [www.xxx.yyyy.zzz] port 22.
debug1: Connection established.
debug1: identity file /home/userid/.ssh/id_rsa type 1
debug1: identity file /home/userid/.ssh/id_rsa-cert type -1
debug1: identity file /home/userid/.ssh/id_dsa type -1
debug1: identity file /home/userid/.ssh/id_dsa-cert type -1
debug1: identity file /home/userid/.ssh/id_ecdsa type -1
debug1: identity file /home/userid/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/userid/.ssh/id_ed25519 type -1
debug1: identity file /home/userid/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version 1.82_sshlib Globalscape
debug1: no match: 1.82_sshlib Globalscape
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: kex: diffie-hellman-group-exchange-sha1 need=16 dh_need=16
debug1: kex: diffie-hellman-group-exchange-sha1 need=16 dh_need=16
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<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 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff
debug1: Host 'ftp.example.com' is known and matches the RSA host key.
debug1: Found key in /home/userid/.ssh/known_hosts:2
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
Welcome to Enhanced FTP Service (ftp)
debug1: Authentications that can continue: password
debug1: Next authentication method: password
userid@ftp.example.com's password:
debug1: Authentication succeeded (password).
Authenticated to ftp.example.com ([www.xxx.yyyy.zzz]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = ja_JP.UTF-8
debug1: Sending subsystem: sftp
Connected to ftp.example.com.
パスワード入力のプロンプト userid@ftp.example.com's password:
の前後にある
debug1: Authentications that can continue: password
debug1: Next authentication method: password
と
debug1: Authentication succeeded (password).
からパスワード認証を行い、成功したことを確認できます。