添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
帅气的松球  ·  Solved: ...·  1 月前    · 
温柔的烤红薯  ·  备份配置文件·  1 月前    · 
讲道义的猴子  ·  PHP: FTP 函数 - Manual·  1 月前    · 
玉树临风的硬币  ·  vue ...·  1 年前    · 
傲视众生的伤疤  ·  MaxCompute ...·  1 年前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, i have trying to connect to my server with SFTP, but i don't know how can I specify the authentication method as i cannot use the publickey file.

*   Trying xx.xx.xx.41...
* TCP_NODELAY set
* Connected to xx.xx.xx.41 (xx.xx.xx.41) port 22 (#0)
* SSH MD5 fingerprint: xxx...5d07
* SSH authentication methods available: publickey,password
* Using SSH private key file ''
* SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
* No identity would match
* Authentication failure
* Closing connection 0

As you can see in the response, the methods available are publickey and password, but i need help figuring out how to specify the second one. The program tries to use the publickey even if the password is provided.

I have tried -P and several settings but nothing worked.

Thanks

There are at least three ways to specify the password.

# store the password in your config
git config git-ftp.password secr3t
git init
# let is ask for a password
git init -P
# specify the password
git init -p secr3t

But it looks like you tried them all already. Can you connect with another program using the same password? Does it work with the --insecure flag?

Yes, i have tried all methods to specify my password, and yes, i have connected successfully to my server with filezilla and other SFTP programs like Cyberduck or the SFTP plugin for Sublime Text.

My issue is that the software is trying to authenticate using the key instead of the user and password.

Both secure and insecure options return the same error.
Might this be related with the configuration of my local curl library? Maybe i can modify some options on there to force the authentication via password.

Thanks for pointing that test.
I have done a curl directly and got the same exact response:

curl -v -u "user:password" "sftp://xx.xx.xx.41:22/srv/path/"
*   Trying xx.xx.xx.41...
* TCP_NODELAY set
* Connected to xx.xx.xx.41 (xx.xx.xx.41) port 22 (#0)
* SSH MD5 fingerprint: xxx...d07
* SSH host check: 0, key: AAAA...xxx...tUq7
* SSH authentication methods available: publickey,password
* Using SSH private key file ''
* SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
* No identity would match
* Authentication failure
* Closing connection 0
curl: (67) Authentication failure

I assume now that i should change the options in my curl library instead of the git-ftp.
Thanks for everything and sorry for bothering.

Hey @mkllnk looks like i have found an option to use with curl that lets me identify with password. Adding -o PreferredAuthentications=password does the trick.

curl -v -u "USER" "sftp://xx.xx.xx.41:22/srv/path/" -o PreferredAuthentications=password
Enter host password for user 'USER':
*   Trying xx.xx.xx.41...
* TCP_NODELAY set
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to xx.xx.xx.41 (xx.xx.xx.41) port 22 (#0)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* SSH MD5 fingerprint: 627...d07
* SSH host check: 0, key: AAA...tUq7
* SSH authentication methods available: publickey,password
* Using SSH private key file ''
* SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
* Initialized password authentication
* Authentication complete
} [74 bytes data]
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
* Connection #0 to host xx.xx.xx.41 left intact

I hope this helps someone, and maybe you could add this option in the future so the users can use it to authenticate.

Thanks for everything.