Show Menu
Cheatography

Info

Instal­lation

yum install openss­h-s­erver openss­h-c­lient openss­h-a­skpass Redhat Enterprise Linux

Overview

/etc/s­sh/­moduli Diffie­-He­llman groups used for the Diffie­-He­llman key exchange
/etc/s­sh/­ssh­_config default SSH client config­uration file
/etc/s­sh/­ssh­d_c­onfig config­uration file for the sshd daemon
/etc/s­sh/­ssh­_ho­st_­ecd­sa_key ECDSA private key used by the sshd daemon
/etc/s­sh/­ssh­_ho­st_­ecd­sa_­key.pub ECDSA public key used by the sshd daemon
/etc/s­sh/­ssh­_ho­st_­rsa_key RSA private key used by the sshd daemon
/etc/s­sh/­ssh­_ho­st_­rsa­_ke­y.pub RSA public key used by the sshd daemon
/etc/p­am.d­/sshd PAM config­uration file for the sshd daemon
/etc/s­ysc­onf­ig/sshd Config­uration file for the sshd service
~/.ssh­/au­tho­riz­ed_keys list of authorized public keys for servers
~/.ssh­/id­_ecdsa ECDSA private key of the user
~/.ssh­/id­_ec­dsa.pub ECDSA public key of the user
~/.ssh­/id_rsa RSA private key of the user
~/.ssh­/id­_rs­a.pub RSA public key of the user
~/.ssh­/kn­own­_hosts host keys of SSH servers accessed by the user
 

Start

systemctl start sshd.s­ervice start the sshd daemon
systemctl stop sshd.s­ervice stop the running sshd daemon
systemctl enable sshd.s­ervice start the sshd daemon at boot
/etc/s­yst­emd­/sy­ste­m/s­shd.se­rvi­ce.d­/l­oca­l.conf
[Unit]
Wants=­net­wor­k-o­nli­ne.t­arget
After=­net­wor­k-o­nli­ne.t­arget

override default service unit for DHCP network

SSH Daemon Config­uration

/etc/s­sh/­ssh­d_c­onfig
Passwo­rdA­uth­ent­ication No
enforce key based authen­tic­ation
setsebool -P use_nf­s_h­ome­_dirs 1 use key based authen­tic­ation with NFS-mo­unted home directory
ssh-keygen -l -f /etc/s­sh/­ssh­_ho­st_­ecd­sa_­key.pub show remote server finger­print
ssh-keygen -l -f /etc/s­sh/­ssh­_ho­st_­ecd­sa_­key.pub -EM md5 show remote server MD5 finger­print
/etc/s­sh/­ssh­d_c­onfig
AllowT­cpF­orw­arding No
disable port forwarding
 

SSH Client Config­uration

ssh-keygen -t rsa generate RSA keypair
ssh-co­py-id user@host copy the public RSA key to remote host
ssh-keygen -t ecdsa generate ECDSA keypair
ssh-co­py-id user@host copy the public ECDSA key to remote host
ssh-add save passphrase for shell prompt
ssh-keygen -R host remove the key for the host
ssh user@host command execute a command on the remote machine
scp /path/­to/­loc­alfile user@host:/path/­to/­rem­otefile transfer a local file to a remote system
scp /path/to/* user@host:/path/to/* transfer a multiple files to a remote system
scp user@host:/path/­to/­rem­otefile /path/­to/­loc­alfile transfer a remote file to the local system
sftp user@host secure FTP to a remote system
ls list the content of remote directory
cd change remote working directory
mkdir create remote directory
rmdir remove remote directory
put transfer localfile to a remote machine
get transfer remotefile from a remote system

Tips & Tricks

ssh -Y user@host open an X11 session over an SSH connection (X window system must be installed on remote system)
ssh -L local-­por­t:r­emo­te-­hos­tna­me:­rem­ote­-port user@host create TCP/IP port forwarding channel
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          File Transfers Cheat Sheet
          Tmux Cheat Sheet

          More Cheat Sheets by misterrabinhalder

          RPM Cheat Sheet