2017-06-18 20:12:00 +01:00
|
|
|
# sshpass
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
> An SSH password provider.
|
|
|
|
> It works by creating a TTY, feeding the password into it, and then redirecting `stdin` to the SSH session.
|
2021-10-04 13:39:50 +01:00
|
|
|
> More information: <https://manned.org/sshpass>.
|
2017-06-18 20:12:00 +01:00
|
|
|
|
2022-12-04 07:53:34 +00:00
|
|
|
- Connect to a remote server using a password supplied on a file descriptor (in this case, `stdin`):
|
2017-06-18 20:12:00 +01:00
|
|
|
|
|
|
|
`sshpass -d {{0}} ssh {{user}}@{{hostname}}`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Connect to a remote server with the password supplied as an option, and automatically accept unknown SSH keys:
|
2017-06-18 20:12:00 +01:00
|
|
|
|
2017-06-18 23:27:11 +01:00
|
|
|
`sshpass -p {{password}} ssh -o StrictHostKeyChecking=no {{user}}@{{hostname}}`
|
2017-06-18 20:12:00 +01:00
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Connect to a remote server using the first line of a file as the password, automatically accept unknown SSH keys, and launch a command:
|
2017-06-18 20:12:00 +01:00
|
|
|
|
2022-12-04 09:12:49 +00:00
|
|
|
`sshpass -f {{path/to/file}} ssh -o StrictHostKeyChecking=no {{user}}@{{hostname}} "{{command}}"`
|