Difference between revisions of "/etc/ssh/ssh config"

From wikieduonline
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
== Examples ==
 
== Examples ==
=== Basic example ===
+
== Basic example ==
 
  Host your_machine_name
 
  Host your_machine_name
 
     Hostname IP_or_dns_name
 
     Hostname IP_or_dns_name
Line 13: Line 13:
 
     [[IdentityFile]] ~/[[.ssh/id_ed25519]]      #Private key
 
     [[IdentityFile]] ~/[[.ssh/id_ed25519]]      #Private key
  
 +
== Example with auto [[tmux]] and session persistence ==
  
==
+
Host your_machine_name
ControlMaster auto
+
    Hostname IP_or_dns_name
ControlPath ~/.ssh/sockets/%C
+
    User [[Default usernames|USERNAME_TO_CONNECT]]
ControlPersist 10h
+
    [[IdentityFile]] ~/[[.ssh/id_ed25519]]      #Private key
 +
    [[RemoteCommand]] sudo su - -c "[[tmux new]] -A -s main"
 +
    [[RequestTTY]] yes
 +
    [[ControlMaster]] auto
 +
    [[ControlPath]] [[~/.ssh/sockets/]]%C
 +
    [[ControlPersist]] 10h
 +
    [[ServerAliveInterval]] 60
  
 
+
== Example with [[ProxyJump]]  ==
=== Example with [[ProxyJump]]  ===
 
 
  Host machine_name_for_ssh_client
 
  Host machine_name_for_ssh_client
 
     [[ProxyJump]] YOUR_SERVER_TO_USE_AS_JUMPSERVER
 
     [[ProxyJump]] YOUR_SERVER_TO_USE_AS_JUMPSERVER
Line 29: Line 35:
  
 
== [[Configure OpenSSH to reuse ssh connections]] ==
 
== [[Configure OpenSSH to reuse ssh connections]] ==
 +
[[RequestTTY]] yes
 
  [[ControlMaster]] auto
 
  [[ControlMaster]] auto
 
  [[ControlPath]] ~/.ssh/sockets/%r@%h-%p
 
  [[ControlPath]] ~/.ssh/sockets/%r@%h-%p
Line 52: Line 59:
 
== Errors ==
 
== Errors ==
 
* <code>[[bad configuration option:]]</code>
 
* <code>[[bad configuration option:]]</code>
 +
 +
== Activities ==
 +
* [[Configure OpenSSH to reuse ssh connections]]
  
 
== Related terms ==
 
== Related terms ==

Latest revision as of 10:41, 24 July 2026

OpenSSH client configuration file.

Man page: https://man7.org/linux/man-pages/man5/ssh_config.5.html

Examples[edit]

Basic example[edit]

Host your_machine_name
    Hostname IP_or_dns_name
    User USERNAME_TO_CONNECT
    IdentityFile ~/.ssh/id_ed25519       #Private key

Example with auto tmux and session persistence[edit]

Host your_machine_name
    Hostname IP_or_dns_name
    User USERNAME_TO_CONNECT
    IdentityFile ~/.ssh/id_ed25519       #Private key
    RemoteCommand sudo su - -c "tmux new -A -s main"
    RequestTTY yes
    ControlMaster auto
    ControlPath ~/.ssh/sockets/%C
    ControlPersist 10h
    ServerAliveInterval 60

Example with ProxyJump[edit]

Host machine_name_for_ssh_client
    ProxyJump YOUR_SERVER_TO_USE_AS_JUMPSERVER
    Hostname (IP or hostname)
    Port 22
    User USERNAME_TO_CONNECT
    IdentityFile ~/.ssh/id_ed25519

Configure OpenSSH to reuse ssh connections[edit]

RequestTTY yes
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 36000

OpenSSH Changelog[edit]


To allow connection to some Cisco IOS devices:

Directives[edit]

Errors[edit]

Activities[edit]

Related terms[edit]

See also[edit]

Advertising: