hostedpi ssh config
Get the SSH config to connect to one or more Raspberry Pi servers
Usage: hostedpi ssh config [OPTIONS] [NAMES]...
Arguments
- names [str ...]
Names of the Raspberry Pi servers to get SSH config for
Options
- --filter [str]
Search pattern for filtering server names
- --ipv6
Use the IPv6 connection method
- --numeric -n
Use the IPv6 address instead of the hostname
- --username -u [str]
The username to use when connecting
- --no-user
Don’t include a username in SSH command
- --help
Show this message and exit
Usage
The SSH config file is a convenient way to store SSH connection information for multiple hosts. It allows you to connect to a host using a simple command like ssh mypi instead of typing the full command every time.
It is generally useful to redirect the output of this command to your SSH config file, which is usually located at ~/.ssh/config. Outputting to the terminal is useful for copy-pasting, but redirecting to the config file allows you to automate the process. You will need to prune this file as you provision and deprovision Pis.
Output the IPv4 SSH config for a Pi:
$ hostedpi ssh config mypi
Host mypi
user root
port 5224
hostname ssh.mypi.hostedpi.com
Output the IPv6 SSH config for a Pi:
$ hostedpi ssh config mypi --ipv6
Host mypi
user root
hostname mypi.hostedpi.com
Warning
You will need IPv6 connectivity to connect using the IPv6 address.
Output the IPv6 SSH config for a Pi, using a custom username and numeric address:
$ hostedpi ssh config mypi --ipv6 --numeric --username pi
Host mypi
user pi
hostname 2a00:1098:8:14b::1
Output the IPv6 SSH config for a Pi, using the numeric address and specifying no username:
$ hostedpi ssh config mypi --ipv6 --numeric --no-user
Host mypi
hostname 2a00:1098:8:14b::1
Output the IPv4 SSH config for multiple Pis:
$ hostedpi ssh config mypi mypi2
Host mypi
user root
port 5224
hostname ssh.mypi.hostedpi.com
Host mypi2
user root
port 5072
hostname ssh.mypi2.hostedpi.com
Save (append) the IPv4 SSH config for all Pis in the account into your SSH config file:
$ hostedpi ssh config >> ~/.ssh/config
Note
Read more about the SSH config file: https://www.ssh.com/ssh/config/