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
参考