ssh

ssh key

[!TIP|label:resolve ssh permission issue:]

get servers public key

add ssh key into agent

get public key from private key

generate new passphrase

get fingerprinter

  • sha256:

  • md5:

with openssl

keys performance

ssh

force use password

allows ssh-rsa

[!TIP|label:references:]

  • for git commands

    [!NOTE|label:references:]

force bypass ~/.ssh/config

[!NOTE|label:references:]

[!TIP|label:references:]

tar all and extra in remote

copy local file content into remote

[!NOTE|label:references:]

with proxy

using command directly

  • Linux:

  • windows:

    • git for windows

    • cygwin

ssh certificate

[!NOTE|label:references:]

ca

sign and generate cert key

  • verify

update for existing key

login via specific cert

[!NOTE|label:references:]

ssh tunnel

[!TIP|label:references:]

two servers

-L

in jumper

[!TIP]

  • purpose:

-R

[!TIP]

  • status:

three serves

scenario 1

in jumper

> - purpose: > ```bash > local:6666 <--- jumper:6666 <--- remote:6666 > ```

scenario 2

[!TIP]

  • details :

config

ssh config

sshd_config

[!TIP]

  • disable Root Login : PermitRootLogin

  • allow only specific users or groups : AllowUsers, AllowGroups

  • deny specific users or groups : DenyUsers, DenyGroups

  • change sshd port number : Port

  • change login grace time : LoginGraceTime

  • Restrict the Interface (IP Address) to Login : ListenAddress

  • disconnect ssh when no activity : ClientAliveInterval

[!TIP] files:

  • /etc/pam.d/sshd : session optional pam_motd.so : /usr/lib64/security/pam_motd.so

  • /etc/motd

  • /etc/ssh/sshd_config : Banner /path/to/banner

disable login password

  • scripts:

disallow group to use password

[!TIP|label:references:]

  • Directive 'UsePAM' is not allowed within a Match block

  • Directive 'ChallengeResponseAuthentication' is not allowed within a Match block

  • Directive 'PrintMotd' is not allowed within a Match block

  • Directive 'LoginGraceTime' is not allowed within a Match block

disallowing user to use tcp forwarding

displaying a special banner for users not in the staff group

allowing root login from host rootallowed.example.com

allowing anyone to use gatewayports from the local net

debug

debug git

  • GIT_SSH_COMMAND

debug ssh

  • debug mode

  • test mode

check sshd log

[!NOTE|label:references:]

tips

[!NOTE|label:references:]

disconnect

[!TIP] Enter + ~ + . + Enter

references:

execute shell commands via ssh

[!NOTE|label:references:]

ctrl-c to break while loop

execute local script via ssh

[!NOTE|label:references:]

how ssh works

Last updated

Was this helpful?