It’s config language is designed for that, too. The following should work:
# Setdefault username across all hosts
Host *User default_username
or
# Tomatch "host1..3"
Match Host host1.example.com host2.example.com host3.example.com
User default_username
I still think the script is a good idea. I do something similar with a shell script to add entries. Your choice of Python would make maintaining and parsing a lot more straightforward than shell.
The “host” is just your friendly name for the connection, not necessarily the hostname of the remote host. You can specify the same username or hostname as many times as you want. My config is made up of mostly blocks like this:
Host server1
HostName server1.you.com
User your_ssh_username
IdentityFile ~/.ssh/yourprivatekey.pem
Host server2
HostName server2.you.com
User your_ssh_username
IdentityFile ~/.ssh/yourprivatekey.pem
Wouldnt really help in my use case bc I use the same user on every server
It was just an example. What does your script do that wouldn’t be configurable in ssh config
not much, probably. Ill add some features in the future tho
It’s config language is designed for that, too. The following should work:
# Set default username across all hosts Host * User default_username
or
# To match "host1..3" Match Host host1.example.com host2.example.com host3.example.com User default_username
I still think the script is a good idea. I do something similar with a shell script to add entries. Your choice of Python would make maintaining and parsing a lot more straightforward than shell.
The “host” is just your friendly name for the connection, not necessarily the hostname of the remote host. You can specify the same username or hostname as many times as you want. My config is made up of mostly blocks like this: