Ssh Sftp



Recently, Microsoft has released a port of OpenSSH for Windows. You can use the package to set up an SFTP/SSH server on Windows.

To automate tasks that create and manage files on a Secure File Transfer Protocol (SFTP) server using the Secure Shell (SSH) protocol, you can create automated integration workflows by using Azure Logic Apps and the SFTP-SSH connector. Description sftp is an interactive file transfer program, similar to ftp (1), which performs all operations over an encrypted ssh (1) transport. It may also use many features of ssh, such as public key authentication and compression. Sftp connects and logs into the specified host, then enters an interactive command mode.

  • Installing SFTP/SSH Server
  • Connecting to the server

SFTP (SSH File Transfer Protocol) is a secure file transfer protocol. It runs over the SSH protocol. It supports the full security and authentication functionality of SSH. SFTP has pretty much replaced legacy FTP as a file transfer protocol, and is quickly replacing FTP/S. It provides all the functionality offered by these protocols, but more. SFTP: the acronym stands for SSH File Stransfer Protocol, and – as the name says itself – it is a subsystem of the SSH (Secure Shell) protocol FTPS: it is a “secured” version of the FTP protocol, encapsulated inside a SSL or TLS channel (just like HTTPS, SMTPS, IMAPS, POP3S. Jun 05, 2020 The sftp and scp clients on the IBM i require Public-key authentication to gain access to ssh servers. Password authentication is not allowed with these two clients. The IBM i ssh client can use either Public-key authentication or Password authentication to gain access to ssh servers.

Advertisement

  • In Settings app, go to Apps > Apps & features > Manage optional features.
  • Locate “OpenSSH server” feature, expand it, and select Install.

Binaries are installed to %WINDIR%System32OpenSSH. Configuration file (sshd_config) and host keys are installed to %ProgramData%ssh (only after the server is started for the first time).

You may still want to use the following manual installation if you want to install a newer version of OpenSSH than the one built into Windows 10.

  • Download the latest OpenSSH for Windows binaries (package OpenSSH-Win64.zip or OpenSSH-Win32.zip)
  • As the Administrator, extract the package to C:Program FilesOpenSSH
  • As the Administrator, install sshd and ssh-agent services:
  • Allow incoming connections to SSH server in Windows Firewall:
    • When installed as an optional feature, the firewall rule “OpenSSH SSH Server (sshd)” should have been created automatically. If not, proceed to create and enable the rule as follows.
    • Either run the following PowerShell command as the Administrator:
      Replace C:System32OpenSSHsshd.exe with the actual path to the sshd.exe (C:Program FilesOpenSSHssh.exe, had you followed the manual installation instructions above).
    • or go to Control Panel > System and Security > Windows Defender Firewall1 > Advanced Settings > Inbound Rules and add a new rule for port 22.
  • Start the service and/or configure automatic start:
    • Go to Control Panel > System and Security > Administrative Tools and open Services. Locate OpenSSH SSH Server service.
    • If you want the server to start automatically when your machine is started: Go to Action > Properties. In the Properties dialog, change Startup type to Automatic and confirm.
    • Start the OpenSSH SSH Server service by clicking the Start the service.

These instructions are partially based on the official deployment instructions.

Follow a generic guide for Setting up SSH public key authentication in *nix OpenSSH server, with the following difference:

  • Create the .ssh folder (for the authorized_keys file) in your Windows account profile folder (typically in C:Usersusername.ssh).2
  • For permissions to the .ssh folder and the authorized_keys file, what matters are Windows ACL permissions, not simple *nix permissions. Set the ACL so that the respective Windows account is the owner of the folder and the file and is the only account that has a write access to them. The account that runs OpenSSH SSH Server service (typically SYSTEM or sshd) needs to have read access to the file.
  • Though, with the default Win32-OpenSSH configuration there is an exception set in sshd_config for accounts in Administrators group. For these, the server uses a different location for the authorized keys file: %ALLUSERSPROFILE%sshadministrators_authorized_keys (i.e. typically C:ProgramDatasshadministrators_authorized_keys).

Before the first connection, find out the fingerprint of the server’s host key by using ssh-keygen.exe for each file.

In Windows command-prompt, use:

Replace %WINDIR%System32 with %ProgramFiles%, if appropriate.

In PowerShell, use:

Replace $env:WINDIRSystem32 with $env:ProgramFiles, if appropriate.

You will get an output like this:

Start WinSCP. Login dialog will appear. On the dialog:

  • Make sure New site node is selected.
  • On New site node, make sure the SFTP protocol is selected.
  • Enter your machine/server IP address (or a hostname) into the Host name box.
  • Enter your Windows account name to the User name box. It might have to be entered in the format user@domain if running on a domain.
  • For a public key authentication:
    • Press the Advanced button to open Advanced site settings dialog and go to SSH > Authentication page.
    • In Private key file box select your private key file.
    • Submit Advanced site settings dialog with the OK button.
  • For a password authentication:
    • Enter your Windows account password to the Password box.
    • If your Windows account does not have a password, you cannot authenticate with the password authentication (i.e. with an empty password), you need to use the public key authentication.
  • Save your site settings using the Save button.
  • Login using Login button.
  • Verify the host key by comparing fingerprints with those collected before (see above).

Advertisement

If you cannot authenticate to the server and use Windows 10 Developer mode, make sure that your OpenSSH server does not conflict with an internal SSH server used by the Developer mode. You may need to turn off the SSH Server Broker and SSH Server Proxy Windows services. Or run your OpenSSH server on a different port than 22.

  • Guide to Installing Secure FTP Server on Windows using IIS;
  • Guide to uploading files to SFTP server;
  • Guide to automating operations (including upload).
  1. Windows Firewall on older versions of Windows.Back
  2. Windows File Explorer does not allow you to create a folder starting with a dot directly. As a workaround, use .ssh., the trailing dot will allow you to bypass the restriction, but will not be included in the name.Back
-->

SFTP (SSH File Transfer Protocol) is a network protocol that provides file access, file transfer, and file management over any reliable data stream. It was designed by the Internet Engineering Task Force (IETF) as an extension of the Secure Shell protocol (SSH) version 2.0 to provide secure file transfer capabilities.

This connector is available in the following products and regions:

ServiceClassRegions
Logic AppsStandardAll Logic Apps regions and Integration Service Environments (ISEs)
Power AutomateStandardAll Power Automate regions except the following:
- US Government (GCC High)
Power AppsStandardAll Power Apps regions except the following:
- US Government (GCC High)
Contact
NameMicrosoft
URLMicrosoft LogicApps Support
Microsoft Power Automate Support
Microsoft Power Apps Support
Connector Metadata
PublisherMicrosoft

Trigger limits

The triggers work by polling the SFTP file system, and looking for any file which has been modified since the last poll, comparing files by modification time. Certain tools allow the file modification time to be preserved. In such cases, you need to disable the feature for your trigger to work. Here are some common settings:

SFTP clientAction
WinSCPOptions → Preferences… → Transfer → Edit… → Preserve timestamp → Disable
FileZillaTransfer → Preserve timestamps of transferred files → Disable

When the triggers encounter a new file, it will try to ensure that the new file is completely written. For instance, it is possible that the file is being written or modified, and updates are being made at the time the trigger polled the file server. To avoid returning a file with partial content, the trigger will take note of the timestamp such files which are modified recently, but will not immediately return those files. Those files will be returned only when the trigger polls again. Sometimes, this may lead a delay up to twice the trigger polling interval. This also means that the trigger does not guarantee to return all files in a single run when 'Split On' option is disabled.

Connector in-depth

For more information about the connector, see the in-dept section.

Creating a connection

The connector supports the following authentication types:

DefaultRequired parameters for creating connection.All regionsNot shareable

Default

Applicable: All regions

Required parameters for creating connection.

This is not shareable connection. If the power app is shared with another user, another user will be prompted to create new connection explicitly.

Ssh sftp download
NameTypeDescription
Host server addressstringHost server address
User namestringUser name
PasswordsecurestringPassword
SSH private keysecurestringSSH private key (the content of the file should be provided entirely as is, in the multiline format)
SSH private key passphrasesecurestringSSH private key passphrase (if the private key is protected by a passphrase)
Port numberintSFTP port number (example: 22)
Disable SSH host key validationboolDisable SSH host key validation? (True/False)
SSH host key finger-printstringSSH host key finger-print
Root folder pathstringRoot folder path.

Ssh Sftp Windows

Throttling Limits

NameCallsRenewal Period
API calls per connection15060 seconds

Actions

Copy file

This operation copies a file.

Create file

This operation uploads a file.

Create folder

This operation creates a new folder.

Delete file

This operation deletes a file.

Extract archive to folder

This operation extracts an archive file into a folder (example: .zip).

Get file content

This operation gets file contents using the file id.

Get file content using path

This operation gets file contents using the file path.

Get file metadata

This operation gets file metadata using the file id.

Get file metadata using path

This operation gets file metadata using the file path.

List files in folder

This operation gets files contained in a folder.

List files in root folder

This operation gets the files in the root folder.

Rename File

This operation renames a file.

Update file

This operation updates the file content.

Copy file

This operation copies a file.

Parameters

NameKeyRequiredTypeDescription
source True string

Path to the source file

Destination file path
destination True string

Path to the destination file, including file name

overwrite boolean

Overwrites the destination file if set to 'true'

Get all file metadata
ReadFileMetadataFromServer boolean

Get all file metadata from the SFTP server after file creation is complete. If this is false, some metadata properties may not be returned such as last modified time, etc.

Returns

Blob metadata

Create file

This operation uploads a file.

Parameters

NameKeyRequiredTypeDescription
folderPath True string

Unique path of the folder

File name
name True string

Name of the file

body True binary

Content of the file to create

Get all file metadata
ReadFileMetadataFromServer boolean

Get all file metadata from the SFTP server after file creation is complete. If this is false, some metadata properties may not be returned such as last modified time, etc.

Returns

Blob metadata

Create folder

This operation creates a new folder.

Parameters

NameKeyRequiredTypeDescription
folderPath True string

Select a folder

Name
name True string

Name of the folder

Returns

Blob metadata

Delete file

This operation deletes a file.

Parameters

NameKeyRequiredTypeDescription
id True string

Specify the file

Skip delete if file not found
SkipDeleteIfFileNotFoundOnServer boolean

Skips deletion if a file is not found without failing action.

Extract archive to folder

This operation extracts an archive file into a folder (example: .zip).

Parameters

NameKeyRequiredTypeDescription
source True string

Path to the archive file

Destination folder path
destination True string

Path to the destination folder

overwrite boolean

Overwrites the destination files if set to 'true'

Returns

response
array of BlobMetadata

Get file content

This operation gets file contents using the file id.

Parameters

NameKeyRequiredTypeDescription
id True string

Specify the file id

Infer Content Type
inferContentType boolean

Infer content-type based on extension

Returns

The content of the file.

Get file content using path

This operation gets file contents using the file path.

Parameters

NameKeyRequiredTypeDescription
path True string

Unique path of the file

Infer Content Type
inferContentType boolean

Infer content-type based on extension

Returns

The content of the file.

Get file metadata

This operation gets file metadata using the file id.

Parameters

NameKeyRequiredTypeDescription
id True string

Specify the file id

Returns

Blob metadata

Body
BlobMetadata

Get file metadata using path

This operation gets file metadata using the file path.

Parameters

NameKeyRequiredTypeDescription
path True string

Unique path of the file

Returns

Blob metadata

Body
BlobMetadata

List files in folder

This operation gets files contained in a folder.

Parameters

NameKeyRequiredTypeDescription
id True string

Specify the folder

Returns

response
array of BlobMetadata

List files in root folder

This operation gets the files in the root folder.

Returns

Rename File

This operation renames a file.

Parameters

NameKeyRequiredTypeDescription
id True string

Select a file

New name
newName True string

New name for the file

ReadFileMetadataFromServer boolean

Get all file metadata from the SFTP server after file creation is complete. If this is false, some metadata properties may not be returned such as last modified time, etc.

Returns

Represents blob datasets metadata response

Body
BlobMetadataResponse

Update file

This operation updates the file content.

Parameters

NameKeyRequiredTypeDescription
id True string

Specify the file

File content
body True binary

Content of the file to update

ReadFileMetadataFromServer boolean

Get all file metadata from the SFTP server after file creation is complete. If this is false, some metadata properties may not be returned such as last modified time, etc.

Returns

Blob metadata

Body
BlobMetadata

Triggers

When a file is added or modified

This operation triggers a flow when a file is added or modified in a folder. The trigger will fetch both the file metadata as well as the content of the file. The trigger relies on the last modified time of a file. If a file is being created by a third-party client, the preservation of the last modified time should be disabled in the client. Files larger than 50 megabytes are skipped by the trigger. The trigger does not fire if a file is added/updated in a subfolder. If it is required to trigger on subfolders, multiple triggers should be created.

When files are added or modified (properties only)

This operation triggers a flow when a file is added or modified in a folder. This trigger will only fetch the file metadata. To get the file content, you can use the 'Get file content' operation. The trigger relies on the last modified time of a file. If a file is being created by a third-party client, the preservation of the last modified time should be disabled in the client. The trigger does not fire if a file is added/updated in a subfolder. If it is required to trigger on subfolders, multiple triggers should be created.

When a file is added or modified

Ssh Sftp Server

This operation triggers a flow when a file is added or modified in a folder. The trigger will fetch both the file metadata as well as the content of the file. The trigger relies on the last modified time of a file. If a file is being created by a third-party client, the preservation of the last modified time should be disabled in the client. Files larger than 50 megabytes are skipped by the trigger. The trigger does not fire if a file is added/updated in a subfolder. If it is required to trigger on subfolders, multiple triggers should be created.

Parameters

NameKeyRequiredTypeDescription
folderId True string

Specify a folder

Include file content
includeFileContent boolean

If set to true, file content will also be retrieved along with the trigger response

inferContentType boolean

Infer content-type based on extension

What Is Ssh Sftp

Returns

The content of the file.

File Content
binary

When files are added or modified (properties only)

This operation triggers a flow when a file is added or modified in a folder. This trigger will only fetch the file metadata. To get the file content, you can use the 'Get file content' operation. The trigger relies on the last modified time of a file. If a file is being created by a third-party client, the preservation of the last modified time should be disabled in the client. The trigger does not fire if a file is added/updated in a subfolder. If it is required to trigger on subfolders, multiple triggers should be created.

Parameters

NameKeyRequiredTypeDescription
folderId True string

Select a folder

Number of files
maxFileCount integer

Number of files returned from the trigger (1-100)

Returns

Blob metadata

Definitions

BlobMetadata

Ssh Sftp Openssh

Blob metadata

NamePathTypeDescription
Id string

The unique id of the file or folder.

Name
Name string

The name of the file or folder.

DisplayName string

The display name of the file or folder.

Path
Path string

The path of the file or folder.

LastModified date-time

The date and time the file or folder was last modified.

Size
Size integer

The size of the file or folder.

MediaType string

The media type of the file or folder.

IsFolder
IsFolder boolean

A boolean value (true, false) to indicate whether or not the blob is a folder.

ETag string

The etag of the file or folder.

FileLocator
FileLocator string

The filelocator of the file or folder.

BlobMetadataResponse

Represents blob datasets metadata response

Ssh Sftp Updater Support

NamePathTypeDescription
Id string

The unique id of the file or folder.

Name
Name string

The name of the file or folder.

DisplayName string

The display name of the file or folder.

Path
Path string

The path of the file or folder.

LastModified date-time

The date and time the file or folder was last modified.

Size
Size integer

The size of the file or folder.

MediaType string

The media type of the file or folder.

IsFolder
IsFolder boolean

A boolean value (true, false) to indicate whether or not the blob is a folder.

ETag string

The etag of the file or folder.

FileLocator
FileLocator string

The filelocator of the file or folder.

binary