0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

CurlでSFTP接続する

Posted at

FTPサーバーに接続しようとしたときに下記のエラーメッセージが流れました。

This service allows sftp connections only.
Connection to xx.xxx.xxx.xxx closed.

通常のFTP接続ではアクセスできず、SFTPのみ許可している時に表示されます。curlでSFTP接続を行う方法をメモします。

SFTPで接続する例

下記コマンドで接続できます。

curl -u user:password sftp://xx.xxx.xxx.xxx/path/file.txt

SSH鍵認証を使う場合は次のようにします。その後パスワードを求められた場合は入力しましょう。

curl -u user sftp://xx.xxx.xxx.xxx/path/file.txt --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?