Closed wmccracken closed 3 years ago
Credenitals are supplied as options, to use user/passwor use the following:
auth := scp.NewAuthProvider(nil, option.NewBasicAuth("myuser", "password")) data, err := fs.DownloadWithURL(context.Background(), "scp://127.0.0.1/etc/hosts", auth)
How would this work with ssh keys instead of basic auth?
Sent from my iPhone
On Feb 6, 2021, at 7:41 PM, adranwit notifications@github.com wrote:
Credenitals are supplied as options, to user user/passwor dyou the use the following:
auth := scp.NewAuthProvider(nil, option.NewBasicAuth("myuser", "password")) data, err := fs.DownloadWithURL(context.Background(), "scp://127.0.0.1/etc/hosts", auth)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/viant/afs/issues/8#issuecomment-774567090, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAAX3ZXPH2BVBQ6YNCAHR43S5XORPANCNFSM4XGK7WKA.
auth := scp.NewAuthProvider(nil, option.NewBasicAuth("myuser", "password")) this should use only basic auth, thus no ssh keys are needed,
SSH auth supported methods:
auth := scp.NewAuthProvider(scp.NewKeyAuth(path.Join(os.Getenv("HOME"), ".ssh", "id_rsa"), "myuser", "optional_password_for_pem_file_leave_empty_otherwise"), nil)
data, err := fs.DownloadWithURL(context.Background(), "scp://127.0.0.1/etc/hosts", auth)
Thank you!
Hello,
I was wondering how to specify the username of the remote user when using scp with LocalhostKeyAuth. It appears to try and connect as the user that is running the program (USER from env). I tried modifying the url to scp://user@host:22/path/to/file but that does not work.
Thanks!
-Will