Openssh client config: Difference between revisions
From wikinotes
No edit summary |
|||
Line 65: | Line 65: | ||
= SSH config = | = SSH config = | ||
<blockquote> | |||
== Basics == | |||
<blockquote> | <blockquote> | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 85: | Line 87: | ||
git clone ssh://deathstar:/home/vaderd/repo | git clone ssh://deathstar:/home/vaderd/repo | ||
</source> | </source> | ||
</blockquote><!-- Basics --> | |||
</blockquote><!-- | == Useful Options == | ||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
Host deathstar | |||
RemoteCommand cd /bridge && bash -i # execute command on login | |||
</syntaxhighlight> | |||
</blockquote><!-- Useful Options --> | |||
</blockquote><!-- SSH config--> |
Latest revision as of 15:36, 3 September 2023
Documentation
man ssh_config
https://man.archlinux.org/man/core/openssh/ssh_config.5.en
Locations
Unix
/etc/ssh/ssh_config
global config ~/.ssh/config
user config ~/.ssh/{key}.pub
public ssh key ~/.ssh/{key}
private ssh key Windows
SSH keys
SSH keys are a secure method of passwordless SSH authentication.
You can create a keypair using various algorithms, ed2559 is currently considered the most secure.Generate SSH keys
ssh-keygen -t ed25519 chmod 600 ~/.ssh/*Authorize SSH keys
Append your public key to a new line in
~/.ssh/authorized_keys
to allow SSHing ing as that user on that server.SSH is picky about permissions.
mkdir ~/.ssh chmod 700 ~/.ssh touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys cat id_ed25519 >> ~/.ssh/authorized_keysPermissions
On windows, permissions are tricky.
icacls .\private.key /inheritance:r icacls .\private.key /grant:r "%username%":"(R)" # if you've broken permissions, reset using gsudo icacls .\private.key /T /Q /C /RESET
SSH config
Basics
# ~/.ssh/config Host deathstar User vaderd Port 2222 HostName 1.1.1.1 IdentityFile ~/.ssh/impreials # .. can add multiple entries# equivalent to: # ssh -p 2222 vaderd@1.1.1.1 -i ~/.ssh/imperials ssh deathstar # use ssh-config for git git clone ssh://deathstar:/home/vaderd/repoUseful Options
Host deathstar RemoteCommand cd /bridge && bash -i # execute command on login