Show Menu

Openssh Cheat Sheet by

ssh

Instal­lation

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

Overview

/etc­/ss­h/m­oduli Diffie­-He­llman groups used for the Diffie­-He­llman key exchange
/etc­/ss­h/s­sh_­con­fig default SSH client config­uration file
/etc­/ss­h/s­shd­_co­nfig config­uration file for the sshd daemon
/etc­/ss­h/s­sh_­hos­t_e­cds­a_key ECDSA private key used by the sshd daemon
/etc­/ss­h/s­sh_­hos­t_e­cds­a_k­ey.p­ub ECDSA public key used by the sshd daemon
/etc­/ss­h/s­sh_­hos­t_r­sa_­key RSA private key used by the sshd daemon
/etc­/ss­h/s­sh_­hos­t_r­sa_­key.pub RSA public key used by the sshd daemon
/etc­/pa­m.d­/sshd PAM config­uration file for the sshd daemon
/etc­/sy­sco­nfi­g/s­shd Config­uration file for the sshd service
~/.s­sh/­aut­hor­ize­d_k­eys list of authorized public keys for servers
~/.s­sh/­id_­ecdsa ECDSA private key of the user
~/.s­sh/­id_­ecd­sa.p­ub ECDSA public key of the user
~/.s­sh/­id_­rsa RSA private key of the user
~/.s­sh/­id_­rsa.pub RSA public key of the user
~/.s­sh/­kno­wn_­hosts host keys of SSH servers accessed by the user
 

Start

syst­emctl start sshd.s­erv­ice start the sshd daemon
syst­emctl stop sshd.s­erv­ice stop the running sshd daemon
syst­emctl enable sshd.s­erv­ice start the sshd daemon at boot
/etc­/sy­ste­md/­sys­tem­/ss­hd.s­er­vic­e.d­/lo­cal.conf
[Unit]
Wants=­net­wor­k-o­nli­ne.t­arget
After=­net­wor­k-o­nli­ne.t­ar­get

override default service unit for DHCP network

SSH Daemon Config­uration

/etc­/ss­h/s­shd­_config
Passwo­rdA­uth­ent­ication No
enforce key based authen­tic­ation
sets­ebool -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­/ss­h/s­shd­_config
AllowT­cpF­orw­arding No
disable port forwarding
 

SSH Client Config­uration

ssh-­keygen -t rsa generate RSA keypair
ssh-­copy-id user­@h­ost copy the public RSA key to remote host
ssh-­keygen -t ecdsa generate ECDSA keypair
ssh-­copy-id user­@h­ost 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 comma­nd execute a command on the remote machine
scp /path­/to­/lo­cal­file user­@h­ost­:­/pa­th/­to/­rem­ote­file transfer a local file to a remote system
scp /path­/to/* user­@h­ost­:­/pa­th/­to/­* transfer a multiple files to a remote system
scp user­@h­ost­:­/pa­th/­to/­rem­ote­file /path­/to­/lo­cal­file transfer a remote file to the local system
sftp user­@h­ost 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­@h­ost 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@h­ost create TCP/IP port forwarding channel

Download the Openssh Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/misterrabinhalder_openssh.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

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

          SSH Working Cheat Sheet
          File Transfers Cheat Sheet

          More Cheat Sheets by misterrabinhalder

          RPM Cheat Sheet