Use the Secure Shell protocol to execute commands on a remote server using a private key
Go to siteThe Secure Shell (SSH) API is an powerful tool for securely connecting to remote systems over a network, allowing users to easily and securely access their systems or services. This API is useful for a variety of tasks including data transfer and remote system management.
Key-based authentication is a way of validating the identity of the client to the server. It works by generating and exchanging a digital key that must match in order for the user to access the server. This provides an extra layer of security, as it is much harder to guess a digital key than a user password.
With the SSH (key-based auth) API, you can use key-based authentication to create an encrypted, authenticated channel between two computers. This can be used for securely accessing services, such as:
module.exports = defineComponent({
props: {
ssh: {
type: "app",
app: "ssh",
}
},
async run({steps, $}) {
const SSH2Promise = require('ssh2-promise')
const {
host,
port,
username,
privateKey,
} = this.ssh.$auth
const ssh = new SSH2Promise({
host,
port,
username,
privateKey,
})
await ssh.connect()
console.log("Connection established")
// Replace this with the command you'd like to run
const resp = await ssh.exec("whoami")
console.log(resp)
await ssh.close()
},
})
Executes a command on a remote device. See SSH lib docs here
SSH (key-based auth) uses API keys for authentication. When you connect your SSH (key-based auth) account, Pipedream securely stores the keys so you can easily authenticate to SSH (key-based auth) APIs in both code and no-code steps.
Enter the hostname and port of the server you'd like to connect to, your username, and the private key you'd like to use to connect.
This app only supports key pair authentication, not authentication via password. If you need to use a username / password to connect to a host, please use the SSH (password-based auth) app, instead.