Questions tagged [ssh-config]
The ssh-config tag has no summary.
94 questions
2
votes
1
answer
142
views
SSH multiplexing + control master when network connection changes
I have a computer server and a laptop guest, both running Ubuntu.
I set SSH multiplexing and control master in the laptop's .ssh/config like the following:
Host servername
User username
Port 22
...
1
vote
1
answer
103
views
Download dotfiles when SSH-ing with a bash login shell
I'm working with a lot of remote Ubuntu hosts that are changing a lot. To have a streamlined workflow on all hosts I'm downloading my personal dotfiles with bash aliases, small exes and configurations ...
1
vote
0
answers
122
views
Git ls-remote to github fails with classic "SHA-1 not supported" on tunneled ssh session but `ssh -T [email protected]` doesn't
Cross-posting from here as suggested by the community.
A bit of context: At my company we do tunneling to ssh into EC2 boxes. This tunneling command is as usual, uses ForwardAgent and the proxycommand ...
2
votes
1
answer
664
views
How to match IPv6 addresses as a host pattern in ssh_config
My VPS listens to SSH on port 222. On my clients I created a ssh_config such that the non-default port needs not to be explicitly provided on the command line every time. (Some daemons which ...
2
votes
0
answers
248
views
ssh-agent with multiple keys
I have a script which retrieves private keys from a repository database and adds them to the ssh-agent with ssh-add - <<<"----My Private Key----"
The keys don't get stored on the ...
1
vote
1
answer
61
views
SSH Config: How to Stop Repeating a Setting/Have it in the Wildcard Host?
I have a repeating setting remoteCommand, that I'd like to add in the wild card host if possible.
Here is a truncated snippet:
host container-server
host container-1
remoteCommand docker exec -it ...
0
votes
1
answer
687
views
ssh config: I have many hosts who I want to use settings from 2 different wildcard hosts respective, please review my attempt
I have 2 sets of hosts who I want to use settings from 2 seperate wildcard hosts.
I also have a huge number of hosts so need help on which style is best for this scenario. The hosts are mostly in the ...
-1
votes
1
answer
445
views
ssh config: can I have 2 host wildcards?
Simplified Example:
host one
user cat
host two
hostname 2
host three
hostname 3
host *
hostname 1
host *
user apple
identityFile ~/.ssh/id_rsa
host y
hostname 7
host t
...
0
votes
1
answer
132
views
Can i used these aliases in some sort of config file?
I have many of these kinds of aliases, the part before = is the host in ssh config
alias sshConfigHost='ssh -t hostname docker exec -it containerName bash'
Could I add these to some sort of config ...
1
vote
1
answer
555
views
ssh config: can I replace proxy command?
Here is my standard work ssh config which everyone uses:
host go
User user
ProxyJump otherHostname
StrictHostKeyChecking=no
UserKnownHostsFile=/dev/null
IdentityFile ./ssh/key
ProxyCommand ...
0
votes
1
answer
485
views
Create ssh config to VNC server with tunnel via intermediate machine
I recently found out about ssh config file where one can setup frequently used ssh connections. However, I am having troubles transforming one command which connects my computer to VNCServer running ...
1
vote
1
answer
555
views
Add multiple interfaces to one IPv6 Hostname in SSH config [duplicate]
Right now I have the following ~/.ssh/config to reach an embedded device via its link-local IPv6:
Host someDevice
# Hostname fe80::dcad:beff:feef:cafe%%eth0
Hostname fe80::dcad:beff:feef:cafe%%...
2
votes
0
answers
371
views
Conditionally skip ssh-config options when ssh is too old for them?
How can I use SetEnv in ~/.ssh/config (and the same config on various systems), but not throw an error when ssh is too old to support it?
I've tried adding a Match exec statement to exclude that ...
2
votes
0
answers
1k
views
What is the difference between a Match all and a Host * block in ssh_config
As I was reviewing my current OpenSSH client configuration file and intensively reading the ssh_config(5) man page, I found that, from my understanding, both Match all and Host * will achieve the same ...
0
votes
1
answer
579
views
Placeholder in ssh config in HostName
I am trying to simplify the following part:
Host sandbox*
Port 22
User myUser
ProxyCommand=nc -X 5 -x gateway.test.io:1080 %h %p
Host sandbox9
HostName 1.0.9.10
Host sandbox10
...
7
votes
1
answer
5k
views
In ssh config, what does `Match canonical all` mean?
I wanted to use CanonicalizeHostname in my ssh config which would make it possible to add and remove hosts without having to edit the file.
Host bastion
ProxyJump none
Match canonical
...
2
votes
0
answers
929
views
Conditional inclusion in ssh_config
According to ssh_config(5) an Include statement can be placed inside a Match or Host block to create conditionsl inclusion
Include: Include the specified configuration file(s). Multiple pathnames may ...
3
votes
2
answers
407
views
Have OpenSSH quit if `Match exec` command does not return 0
I'm using the SSH Match exec functionality to trigger a script when making a connection, such as:
Match host foo* exec "/some/script.sh"
Host foo
User ubuntu
[... rest of ssh config file ...
2
votes
1
answer
1k
views
SSH Configuration for multiple IP addresses (round-robin or randomized)
I have a machine that I am using as an SSH jumphost which has multiple ethernet ports each of which has its own IP address (192.168.1.22 and 192.168.1.178 in case it matters). I use SSH for a lot of ...
2
votes
1
answer
1k
views
Is there a possibility to add alternative jump servers in ssh config?
If we want to connect to a host through some server, we can do so using the ProxyJump command in ssh config or directly in terminal via:
ssh -J user@server user@target-host
The manual states that ...
0
votes
1
answer
392
views
Apply ssh rule for different hosts
My current .ssh/config file has below config.
Host *
FingerprintHash sha256
StrictHostKeyChecking yes
PasswordAuthentication no
GSSApiAuthentication no
KbdInteractiveAuthentication ...
0
votes
1
answer
296
views
Limit SSH access to specific clients by name (not ip)
I recently migrated one of my servers to a RHEL8 equivalent, which means (i) leaving tcp_wrappers behind (since openssh no longer compiles against libwrap), (ii) no longer have the ease and ...
2
votes
1
answer
2k
views
SSH config for connecting to host via reverse SSH tunnel
I set up a reverse SSH tunnel to access a node, node1, behind a NAT. I have set up an EC2 instance, myEC2, to act as the intermediary. From my laptop, when I want to access node1, I have to SSH into ...
1
vote
2
answers
454
views
How to specify ssh-config for TLD-less domains?
I’m trying to specify configuration for commands of the form ssh foo or ssh bar; where foo and bar are actually foo.xyz.org and bar.xyz.org but xyz.org is supplied by my VPN search domain.
I’ve looked ...
0
votes
0
answers
377
views
How to increase and check number of successful ssh connections to a remote host
I wrote the below loop that creates ssh connections to remotehost1
$ cat sshloop.sh
#!/bin/sh
i=0
while [ $i -ne 500 ]
do
i=$(($i+1))
echo "SSH COUNT IS: $i"
...
4
votes
2
answers
25k
views
How do I run a command after a ssh connection, without disconnecting?
I want to run a command automatically after I connect to another machine via ssh, without the ssh session being closed automatically.
After searching the internet I found some solutions but none of ...
1
vote
1
answer
3k
views
SSH Config - Options - Remove some whilst adding others?
I know that ssh config file is parsed from top down and that it uses the options listed for the first valid match, ignoring ones from later valid matches if it already saw that option. I've tried a ...
0
votes
0
answers
112
views
ssh variable port from host match
Say I have the following config in ~./ssh/config
Host server*-port
HostName 111.111.111.111
User share
IdentityFile ~/.ssh/id_rsa
Port 9%h0
If I do ssh server01-port, I want the port be 9010. ...
4
votes
1
answer
3k
views
ssh percent_expand token %n not working
I'm seeing in the ssh_config man page and on the openssh website that I should be able to use a %n token when locating the identity file for a given host entry.
percent_expand tokens used by OpenSSH's ...
14
votes
4
answers
6k
views
How to bypass RemoteCommand option in ssh_config
I have defined a ssh_config file with all the hosts to which I connect on a regular basis. I like to start/connect to a tmux session upon connection to the host, so I've added the line RemoteCommand ...
0
votes
1
answer
2k
views
Allow ssh access for users with certain UID from certain IP's
I need to allow ssh access to all users, but if the UID is between 6000 and 6500 I need to check if the IP where the ssh is coming from is in the file /etc/remote-hosts.
/etc/remote-hosts
1.2.3.4
5.6....
1
vote
1
answer
1k
views
How to increase the keepalive time with ssh server?
I connect to my device through ssh from my machine.
If I am not active for some relatively short time, it closes the session after sometime.
Connection to 10.X.Y.Z closed by remote host.
Connection to ...
1
vote
1
answer
931
views
RemoteCommand with percent signs doesn't work
The following command
tmux new -A -s $(date +%Y%m%d%H%M%S)
works and starts tmux with a session, named after current datetime (as expected).
But if I put the same in ssh config
RemoteCommand tmux new ...
3
votes
1
answer
1k
views
Nested settings in ssh config for domains and aliased subdomains
How can I have rules for a whole domain and also create aliases with rules for each of the subdomains without duplicating all the ruleset?
In other words, why is it that in the following example ...
2
votes
1
answer
765
views
ssh config to start session with google cloud compute instance using gcloud cli command
I would like to use my ssh config to use a google cloud cli (gcloud) to connect to google compute instances. (This is a follow-on to another question I asked, that had a working solution, but didn't ...
2
votes
2
answers
2k
views
ssh config to start session with google cloud compute instance
I would like to use my ssh config to use a google cloud compute instance as a jumpbox to connect to another box. However, I am having problems getting a config that will allow me to even connect to ...
1
vote
0
answers
1k
views
How can I set up my Linux server to permit password login for sftp only, and require public private key for ssh?
I have a Linux server which I have configured to login with public private key for my account - and it works well. It's a long time since I set it up, so I can't remember what steps I took - but it's ...
0
votes
3
answers
7k
views
How to run sudo gedit without connection refusal?
I'm installing and configuring the ssh in CentOs 8 with a virtual box machine.
I installed both libraries with following command:
sudo yum install openssh-server openssh-clients
Then I started the ...
2
votes
1
answer
1k
views
Edit ssh_config without ssh connection on a remote VPS
Yesterday, I was busy setting up a remote server and securing it. I am a noob at code, programming and webhosting, but I am trying to host my own website.
So yesterday I changed some settings in the ...
4
votes
2
answers
2k
views
Match Exec failing to execute anything
Testing out the SSH Match Exec feature. I have this minimal ~/.ssh/config:
Match Exec echo
ServerAliveInterval 60
and I am running
ssh localhost
I get
Unable to execute 'echo': No such file or ...
0
votes
1
answer
782
views
sshfs in fstab connection reset with ssh tunnel in ~/.ssh/conf when 'manual' command works fine
I'm trying to set up an sshfs mount in fstab for persistent mounting of a network directory that has to be accessed via an ssh tunnel.
my .ssh/config looks like this:
Host A
Hostname outer....
2
votes
1
answer
478
views
Does ssh-add honor the declarations made in ssh_config file(s)?
Background
I use a 4096-bit RSA key-pair for authorizing access to my server. By ssh_config files I am referring to ~/.ssh/config and /etc/ssh/ssh_config.
Here's what my ~/.ssh/config looks like:
...
0
votes
1
answer
218
views
ssh ask passwd also after copy-id
the problem is from his machine to this server, to other pc is all ok .the server correctly receive ssh connection from other pc whitout asking pass!
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
...
3
votes
1
answer
15k
views
SSH ForceCommand for shell while keeping regular login and remote command execution possible
How can I run/tweak this command and while using ForceCommand to give this user their shell?
Client Command
(cat ./sudoPassword ./someCommandInput) | ssh user@ip "sudo -Sp '' someCommand"
Server ...
0
votes
1
answer
510
views
Generating a ssh Host config file out of a Supperputty XML file
I am building a script that generates an ssh config file out of a Supperputty XML Session config file. I don't know which tool could handle it better. I try to achieve it with awk, but I don't receive ...
5
votes
2
answers
20k
views
How to generate a certificate file which to be used with ssh config?
I have a configuration as below in my ~/.ssh/config file:
Host xxx
HostName 127.0.0.1
Port 2222
User gigi
ServerAliveInterval 30
IdentityFile ~/blablabla
# CertificateFile ~/...
1
vote
1
answer
353
views
ssh bash completion : sed: -e expression #1, char 97: invalid reference \2 on `s' command's RHS
I'm using Ubuntu 14.04.5 LTS.
The ssh bash completion on any Host of the file ~/.ssh/config does not work :
$ ssh b2sed: -e expression #1, char 97: invalid reference \2 on `s' command's RHS
The ...
3
votes
1
answer
12k
views
SSH config file - Run command before connection
i cannot run a command before connect with ssh to remote server using ~/.ssh/config file.
I have tried with options "ProxyCommand" and "LocalCommand" but it doesn't work.
ProxyCommand: seems it run ...
6
votes
2
answers
4k
views
ssh_config Host * overrides earlier host
Im trying to make my .ssh/config support different ssh keys for the same host so that I can commit to bitbucket as either my personal or work user, and other ssh stuff still uses my work user.
My ...
0
votes
1
answer
627
views
What's the equivalent ssh config of this ssh tunnel command?
I have a host2 remotely forwarding its ssh connection to port 2222 on host1. I am using the following command on host0 to connect to host2 via host1.
ssh -tt host1 ssh -p 2222 localhost
Is there an ...