Private key password for sftp object?
Ältere Kommentare anzeigen
Hello, Matlab2021 has an sftp object like the old ftp object. That can be used with either password authentication or a public and private key (see help sftp).
Our private key however has a password. The matlab "connection" object can handle this, but there doesn't seem to be a way to pass this to the sftp object and my connection is rejected...
Anyone know how to do this?
(We were previously using the ssh2 toolbox from the fileexchange but this has some problems for us).
Thanks in advance.
Antworten (1)
Vidip Jain
am 27 Sep. 2023
0 Stimmen
I understand you want to use a private key with a password for SFTP authentication in MATLAB 2021, you can use the following steps to do the same:
- Create a ‘connection’ object to the SFTP server.
- Set the ‘PrivateKeyFile’ and ‘PrivateKeyPassword’ properties of the connection object.
- Create a ‘sftp’ object using the ‘connection’ object.
The ‘connection’ object can be used to manage the SSH connection to the SFTP server. The ‘connection’ object can also be used to specify the private key file and password.
For further information, refer to the documentation links below:
4 Kommentare
Garrett Good
am 31 Aug. 2024
Walter Roberson
am 31 Aug. 2024
Why not use the syntax
s = sftp(host,user,"PublicKeyFile",publickeyfile,"PrivateKeyFile",privatekeyfile) %uses the key files at the specified locations.
Garrett Good
am 1 Sep. 2024
Bearbeitet: Garrett Good
am 1 Sep. 2024
Nimit Dhulekar
am 29 Mai 2025
Hi Garrett, we introduced
PrivateKeyPassPhrase
in 24b which should satisfy your requirement to pass in a passphrase along with your private key.
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!