Private key password for sftp object?

8 次查看(过去 30 天)
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.

回答(1 个)

Vidip Jain
Vidip Jain 2023-9-27
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:
  1. Create a ‘connection’ object to the SFTP server.
  2. Set the ‘PrivateKeyFile’ and ‘PrivateKeyPassword’ properties of the connection object.
  3. 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:

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by