Forrest logo
back to the sshpass tool

ssh:tldr:a0a0e

ssh: Connect to a remote server with the password supplied as an option, and automatically accept unknown ssh keys.
$ sshpass -p ${password} ssh -o StrictHostKeyChecking=no ${user}@${hostname}
try on your machine

The command sshpass -p ${password} ssh -o StrictHostKeyChecking=no ${user}@${hostname} is used to establish a Secure Shell (SSH) connection to a remote system, bypassing the need for manual password input.

Here is what each component of the command does:

  • sshpass: It is a utility that allows for automated password authentication in SSH connections. It is followed by the -p flag, which specifies the password that will be used for authentication.

  • ${password}: This is a placeholder variable that should be replaced with the actual password you want to use for the SSH connection.

  • ssh: The command to initiate an SSH connection.

  • -o StrictHostKeyChecking=no: This is an option passed to the ssh command to disable strict host key checking. By default, SSH verifies the host keys of remote systems for added security. In this case, StrictHostKeyChecking is disabled to avoid manual confirmation for new or changed host keys.

  • ${user}@${hostname}: These are placeholder variables that should be substituted with the desired username (${user}) and hostname/IP address (${hostname}) of the remote system you want to connect to.

By running this command, an SSH connection will be established to the specified remote system, with the provided password for authentication, and without the need for interactively confirming the remote host's key fingerprint.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the sshpass tool