Questions tagged [ssh-config]
63 questions
337
votes
6 answers
SSH configuration: override the default username
Is it possible to configure ssh to know what my username should be?
By default it uses the current username, which is not correct in my case.
I'm on a loaner laptop, and my username is loaner, but I want to tell ssh that my username is buck.
Bonus…

bukzor
- 37,539
- 11
- 77
- 111
12
votes
1 answer
Given the alias, get the HostName from ssh config
I have an SSH config file like:
Host myAlias
HostName the.actual.host.name.com
Is it possible to resolve the hostname from the alias, from the shell and without connecting to the host? I'm aiming for something like:
$ …

Joe Kearney
- 7,397
- 6
- 34
- 45
11
votes
1 answer
How to specify RemoteForward in the ssh config file?
I'm trying to setup a an ssh tunnel with remote port forwarding. The idea is the have a VPS act as a means to ssh into remote deployed systems (which currently incorporate a Raspberry Pi). Everything seems to work, but I run into issues when trying…

Kanter van Deurzen
- 141
- 1
- 1
- 6
8
votes
2 answers
Validate contents of .ssh/known_hosts file
Is there some cli tool I can use to validate the contents of known_hosts? Maybe try to ping all the hosts in there and see if I can connect to each?
Probably using either ssh-keygen or ssh-keyscan?

Alexander Mills
- 90,741
- 139
- 482
- 817
6
votes
2 answers
mux_client_request_session: session request failed: Session open refused by peer
I use bitbucket to host some git repositories.
When I try to do:
git pull && git push
I get:
mux_client_request_session: session request failed: Session open refused by peer
ControlSocket /home/ravi/.ssh/sockets/socket-git@bitbucket.org:22 already…

Tom Hale
- 40,825
- 36
- 187
- 242
5
votes
3 answers
Grab an IdentityFile from an ssh config based on a variable hostname via shell script
I'm writing a shell script where I need to obtain an IdentityFile from an ssh config file. The ssh config file looks like this:
Host AAAA
User aaaa
IdentityFile /home/aaaa/.ssh/aaaaFILE
IdentitiesOnly yes
PubkeyAuthentication=yes
…

Wimateeka
- 2,474
- 2
- 16
- 32
4
votes
2 answers
ssh: Could not resolve hostname ubuntu: Temporary failure in name resolution
I am trying to implement a ssh config file. It was working with a different ec2 instance moments ago, so I am not sure what is different here. I can ssh -i "key.pem" ubuntun@ipaddress just fine but when I use my config file ssh ubuntu I get the…

Anders Kitson
- 1,413
- 6
- 38
- 98
4
votes
1 answer
Autocomplete slow using zsh for large /.ssh/config file
I currently have a /.ssh/config file the has about 7000 lines in it.
I am trying to see if there is a way to speed up the autocomplete feature in zsh for this.
When I start typing which server I want to ssh into and then press TAB it takes about 10…

Jon Ngo
- 93
- 4
4
votes
1 answer
Can I set ~/.ssh/config to look up dynamic EC2 hostnames?
I have an EC2 instance on a dynamic IP, and it isn't doing any sort of DDNS to keep a public hostname pointed at it. I'd like to set up a shortcut in my ssh_config for the server, and ask aws CLI to tell me what the IP or hostname is.
aws ec2…

Michael
- 8,362
- 6
- 61
- 88
4
votes
2 answers
GCP VMs + ssh/config file
guys.
GCP offers multiple ways of ssh-ing in gcloud, cloud shell, and local machine cloud SDK.
While all these options are great and I have been using them, I normally prefer using .ssh/config to shorten the process of logging in to machines.
For an…

Takeshi
- 41
- 1
- 2
4
votes
1 answer
SSH config to access multiple repo not working
Here's the config file:
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa
Host bitbucket-office.org
HostName bitbucket-off.org
User git
IdentityFile ~/.ssh/work_rsa
Host bitbucket-personal.org
HostName…

Chirag
- 567
- 5
- 20
3
votes
0 answers
Conditionally apply ssh-config
I have to ssh through a bastion host to get at my AWS instances and services. I setup my ssh config to automatically tunnel through the bastion to get to any of the ip addresses in the range for my stuff.
That's great when I'm working from home,…

toadzky
- 3,806
- 1
- 15
- 26
2
votes
1 answer
Script called from ~/.ssh/config loses TTY
I'm using a site-specific authentication script that issues a 24-hour certificate for password-less login. What I'm trying to do is rig my ~/.ssh/config so ssh triggers the script if the certificate has expired:
Match originalhost remotehost.site…

Carl Ponder
- 31
- 2
2
votes
1 answer
How to dynamically change the host in the SSH config file?
I'm trying to connect to a GCP instance, which changes its public IP every time it's restarted. To get the IP dynamically I use this gcloud command:
gcloud compute instances describe --zone europe-west…

Dimitris Poulopoulos
- 87
- 1
- 8
2
votes
1 answer
Git over ssh is ignoring the ssh config
So, I've been messing around with this for a little while now, but git is still acting up. While ssh works just fine now, git is seemingly ignoring my ssh config but I at least know it works when I specify the port and key with a sshCommand in the…

WidgetMidget
- 41
- 1
- 8