SlideShare uma empresa Scribd logo
1 de 2
Baixar para ler offline
OpenSSH Quick Reference                                                Protocol                    SSH protocol                        2, 1         NumberOfPasswordPro
                                                                                                                                                             mpts
                                                                                                                                                                                           Allow the number of password
                                                                                                                                                                                           tries
                                                                                                                                                                                                                                 3

                             Author: Jialong He                                 StrictModes                 check files ownership and perm.     yes
                          Jialong_he@bigfoot.com                                SyslogFacility              Syslog facility code                AUTH
                    http://www.bigfoot.com/~jialong_he                                                                                                       TCPKeepAlive                  Send TCP keepalive to other end       yes
                                                                                TCPKeepAlive                Send TCP keepalive to client        yes
                                                                                                                                                             VerifyHostKeyDNS              Verify the remote key using DNS       no
                                                                                UseDNS                      lookup client DNSname               yes
What is OpenSSH and where to get it                                                                                                                          CheckHostIP                   Check the host IP address in the      yes
                                                                                Compression                 Compress network traffic            yes                                        known_hosts file
OpenSSH is a protocol suite of network connectivity tools that replace
telnet, ftp, rsh, and rcp. It encrypts all traffic (including passwords) to     X11Forwading                Permit X11 forwarding               no
effectively eliminate eavesdropping, connection hijacking, and other
network-level attacks. OpenSSH comes with most Linux distributions.                                                                                          Public Key Authentication
Use command “ssh -V” to check the SSH version installed. The latest
                                                                                Client Configuration                                                         Public key authentication is a preferred method. It is more secure than
                                                                                                                                                             password authentication because no password travels through the network,
version can be found from: www.openssh.org                                      ssh (sftp, scp) are OpenSSH commands to replace telnet, ftp, rcp. The
                                                                                                                                                             but you have to do some setup before you can use public key
                                                                                properties of these program are controlled by (1) command line options,
                                                                                                                                                             authentication. Public key authentication is configured for individual user.
Server Configuration                                                            (2) per user configuration file $HOME/.ssh/config and (3) system wide
                                                                                configuration file /etc/ssh/ssh_config.
sshd is the OpenSSH server (daemon). It is controlled by a configuration                                                                                     (1) Modify SSH server’s configuration file (sshd_config) to enable public
file sshd_config which normally resides in /etc/ssh directory. You can                                                                                       key authentication: (PublicKeyAuthentication yes). Also modify client’s
                                                                                Usage Example:
specify command-line options to override their configuration file                                                                                            configuration file (ssh_config) to use public key authentication
                                                                                ssh user@remotehost # connect to remote host as user
equivalents. Here are some useful options. For the complete list of                                                                                          (PubkeyAuthentication yes). Normally, these are default settings.
                                                                                scp myfile user@remotehost:/home/user # remote copy “myfile”
keywords, see sshd_config (5) manual page.
                                                                                                                                                             (2) Generate a key pair for this user
         Keyword                          Description                 Default   Here are useful keywords in ssh_config. For the complete list of keywords,
                                                                                                                                                               ssh-keygen –t rsa –f $HOME/.ssh/id_rsa
                                                                                see ssh_config (5) manual page.
AllowGroups                   Allow only specified groups to         *
                              connect. May use '*' and '?'.                                Keyword                     Description               Default     It will prompt you a passphrase to encrypt private key. Two files “id_rsa”
                                                                                                            Default host to connect             none         and “id_rsa.pub” will be generated.
AllowUsers                    Allow only specified users to          *          HostName
                              connect. May use '*' and '?'.                     User                        Default user name                   none         (3) Transfer user’s public key (id_rsa.pub) to SSH server and append its
DenyGroups                    Groups NOT allowed connecting.         none       PreferredAuthentications Preferred authentication methods       see left     contents to:
                                                                                                         hostbased, publickey, password                      $HOME/.ssh/authorized_keys or $HOME/.ssh/authorized_keys2.
DenyUsers                     Users NOT allowed connecting.          none
AllowTcpForwarding            TCP forwarding allowed.                yes        HostbasedAuthentication Try hostbased authentication            no           You may also restrict from which computers allowed to use public key
                                                                                PubkeyAuthentication        Try Public key authentication       yes          authentication. For example, in authorized_key file, you put “from” before
GatewayPorts                  Allow other computers to connect       no
                                                                                                                                                             the public key.
                              to the forwarding port.                           PasswordAuthentication      Try password authentication         yes           from=”Goat.domain.com” AAAAB3NzaC1yc2EAAA ….
HostbasedAuthentication Allow host based authentication              no         LocalForward                Specify TCP port forwarding in      none
                        (use .shosts or /etc/shosts.equiv)                                                  LPORT RHOST:RPORT                                (4) Now you can log on to remote system with
                                                                                                                                                               ssh my_sshserver
IgnoreRhosts                  Ignore per user .rhosts and .shosts    yes        RemoteForward               Remote forward port                 none
                              in hostbased authentication.                                                  RPORT LHOST:LPORT                                It will prompt you passphrase to decrypt the private key. If you did not
IgnoreUserKnownHosts          Ignore $HOME/.ssh/known_hosts, no                 GatewayPorts                Allow hosts other than this host to no           give a passphrase in the step 2, you will be connected with asking
                              use only /etc/ssh/ssh_known_hosts                                             connect to the forwarding port                   password.
PasswordAuthentication        Password authentication allowed        yes        ForwardX11                  Forward X11 connection              no           (5) If you do give a passphrase to protect private key, but don’t want to
PermitEmptyPasswords          Allow blank password                   no         Compression                 Compress network traffic            no           type this passphrase every time, it is possible to use ssh agent command:
PublicKeyAuthentication Public key authentication allowed            yes        CompressionLevel            If use compress, compress level     6            eval `ssh-agent`
AuthorizedKeysFile            Public key file name. Default:         see left                                                                                ssh-add ~/.ssh/id_isa
                              $HOME/.ssh/authorized_keys                        Port                        Default remote port                 22
                                                                                                                                                             This will prompt you passphrase once. As long as the current terminal is
ListenAddress                 IP address to accept connection        0.0.0.0    Protocol                    SSH protocol                        2, 1         open, you can connect to the SSH server without typing passphrase. Note,
Port                          Listening port                         22         StrictHostKeyChecking       Allow connect to a host which is    ask          this is only valid for the current terminal, you still need to type passphrase
LogLevel                      sshd verbosity level                   info                                   not in $HOME/.ssh/known_hosts                    in other terminal.
                                                                                                            or /etc/ssh/ssh_known_hosts
PermitRootLogin               Allow root login                       yes                                                                                     In order to run scripts without typing password, the easiest way is to use a
                                                                                LogLevel                    Verbosity level                     info         blank passphrase in step 2. Unlike password, passphrase never travels
PrintLastLog                  Print last login date                  yes
                                                                                                                                                             through the network. It is used for protecting local private key.
PrintMotd                     Print /etc/motd file                   yes
Host-based Authentication                                                     TCP Port Forwarding
Hosted based authentication can be useful to run batch files or scripts on    OpenSSH can forward TCP traffic through SSH connection and secure
remote computers. It is very tricky to configure host based authentication.   TCP applications such as POP3, IMAP or HTTP by direct clear text TCP
Even if you follow the instructions exactly, you might still get a password   traffic through SSH (tunneling). Port forwarding can also redirect some
prompt. In this case, double check file permissions (.shosts) and computer    TCP traffics through firewall.
names (must use FQDN). Restart computer (in order to have sshd read
configuration file).                                                          In order to use port forwarding, you must first establish SSH connection
                                                                              and the connection must stay on as long as forwarding needed. In other
                                                                              words, you have to logon on to SSH server. There are two kinds of port
Server Side                                                                   forwarding: local and remote forwarding

(1) Modify /etc/ssh/sshd_config to enable host based authentication:
  HostbasedAuthentication yes
                                                                              Local Forwarding
  IgnoreRhosts                no
                                                                              In local forwarding, application servers (e.g., mail server) are on the same
  IgnoreUserKnownHosts no # optional
                                                                              computer as the SSH server. For example, suppose we have a server named
  RhostsAuthentication       yes # optional, not recommended
                                                                              “horse” and it has web and SSH servers running. On another computer
                                                                              named “goat”, using following command forwards traffic to an arbitrarily
Let SSH daemon to re-read configuration file by either reboot the
                                                                              chose port (here 12345) on “goat” to port 80 on “horse”,
computer or send “kill –HUP /var/run/sshd.pid”. On Redhat Linux, you
can restart SSH daemon using: service sshd restart
                                                                              ssh –g –L 12345:horse:80 horse
(2) Copy client’s public key to the SSH server. Client’s public key usually
                                                                              If you point a web browser to http://goat:12345, it will show the contents
stored in /etc/ssh/ssh_host_rsa_key.pub on client computer.
                                                                              of http://horse. Here “-g” means that other hosts can access this forwarding
                                                                              port (here 12345). Similarly, you can forward other TCP traffic (e.g., POP3
If client also has OpenSSH server running, you can fetch its public key by:
                                                                              110, IMAP 143) through SSH tunnel.
ssh-keyscan –t rsa client_FQDN > /etc/ssh/ssh_known_hosts2

If per user known hosts is enabled (IgnoreUserKnownHosts no), you             Remote Forwarding
connect to the client’s SSH daemon from the server, the client’s host key
will be saved in: $HOME/.ssh/known_hosts                                      If your application server is on the same machine as SSH client (i.e., you
                                                                              run SSH client on the application server), you should use remote
Note: You MUST use FQDN of client computer to get its public key.             forwarding. For example, we have a server named “horse” and client
Following files are used to store client’s public key on the server.          named “goat”. On “horse”, you run
System wide:                           Per user:
                                                                              ssh –R 12345:horst:80 goat
 /etc/ssh/ssh_known_hosts               $HOME/.ssh/known_hosts
 /etc/ssh/ssh_known_hosts2              $HOME/.ssh/known_hosts2
                                                                              You can point your web browser to http://goat:12345, it will show the
                                                                              content as if you accessed http://horse. This time, you can only access port
(3) Add client’s FQDN in $HOME/.shosts. Please note the permissions for       “12345” on “goat” (no Gateway port).
this file must be owned by the user and NOT writable by group/others.

If (RhostsAuthentication yes), you can also use /etc/hosts.equiv,
but this is NOT recommended. Besides, it has NO effect for root login.


Client Side
(1) Enable host based authentication in SSH client configuration file:
/etc/ssh/ssh_config
HostbasedAuthentication yes

(2) You should have RSA host key pair (normally in /etc/ssh)
ssh_host_rsa_key
ssh_host_rsa_key.pub

If not, generate key pair with:
ssh-keygen –t rsa –f /etc/ssh/ssh_host_rsa_key –N “”

Mais conteúdo relacionado

Mais procurados

101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filtersAcácio Oliveira
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filtersAcácio Oliveira
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell scriptBhavesh Padharia
 
Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Previewleminhvuong
 
Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntaxguestcc37e8c
 
Linux networking commands
Linux networking commandsLinux networking commands
Linux networking commandsSayed Ahmed
 
How to Build Package in Linux Based Systems.
How to Build Package in Linux Based Systems.How to Build Package in Linux Based Systems.
How to Build Package in Linux Based Systems.İbrahim UÇAR
 
Quick Guide with Linux Command Line
Quick Guide with Linux Command LineQuick Guide with Linux Command Line
Quick Guide with Linux Command LineAnuchit Chalothorn
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsYusuf Felly
 
คำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command lineคำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command lineSopit Pairo
 
Linux system admin useful commands
Linux system admin useful commandsLinux system admin useful commands
Linux system admin useful commandsali98091
 
Make container without_docker_7
Make container without_docker_7Make container without_docker_7
Make container without_docker_7Sam Kim
 

Mais procurados (20)

Linux And perl
Linux And perlLinux And perl
Linux And perl
 
Unix cmd
Unix cmdUnix cmd
Unix cmd
 
Cent os 5 ssh
Cent os 5 sshCent os 5 ssh
Cent os 5 ssh
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 
Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Preview
 
Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntax
 
Shell programming
Shell programmingShell programming
Shell programming
 
Linux class 9 15 oct 2021-5
Linux class 9   15 oct 2021-5Linux class 9   15 oct 2021-5
Linux class 9 15 oct 2021-5
 
Linux networking commands
Linux networking commandsLinux networking commands
Linux networking commands
 
How to Build Package in Linux Based Systems.
How to Build Package in Linux Based Systems.How to Build Package in Linux Based Systems.
How to Build Package in Linux Based Systems.
 
Linux class 10 15 oct 2021-6
Linux class 10   15 oct 2021-6Linux class 10   15 oct 2021-6
Linux class 10 15 oct 2021-6
 
Linux
Linux Linux
Linux
 
Quick Guide with Linux Command Line
Quick Guide with Linux Command LineQuick Guide with Linux Command Line
Quick Guide with Linux Command Line
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu Commands
 
คำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command lineคำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command line
 
Linux system admin useful commands
Linux system admin useful commandsLinux system admin useful commands
Linux system admin useful commands
 
Ex200
Ex200Ex200
Ex200
 
Make container without_docker_7
Make container without_docker_7Make container without_docker_7
Make container without_docker_7
 

Semelhante a Open ssh cheet sheat

SSH for pen-testers
SSH for pen-testersSSH for pen-testers
SSH for pen-testersE D Williams
 
Introduction to SSH
Introduction to SSHIntroduction to SSH
Introduction to SSHHemant Shah
 
Using Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should KnowUsing Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should KnowNovell
 
Ssh
SshSsh
Sshgh02
 
Ingite Slides for InSpec
Ingite Slides for InSpecIngite Slides for InSpec
Ingite Slides for InSpecMandi Walls
 
Linux Interview Questions and Answers.pdf
Linux Interview Questions and Answers.pdfLinux Interview Questions and Answers.pdf
Linux Interview Questions and Answers.pdfSudhanshiBakre1
 
Chef Hack Day Denver
Chef Hack Day Denver Chef Hack Day Denver
Chef Hack Day Denver Chef
 
How to increase security with SSH
How to increase security with SSHHow to increase security with SSH
How to increase security with SSHVitalii Sharavara
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network clientroot_fibo
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopBuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopMandi Walls
 
Melbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpecMelbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpecMatt Ray
 
Compliance as Code: Velocity with Security - Fraser Pollock, Chef
Compliance as Code: Velocity with Security - Fraser Pollock, ChefCompliance as Code: Velocity with Security - Fraser Pollock, Chef
Compliance as Code: Velocity with Security - Fraser Pollock, ChefAlert Logic
 
OpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeOpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeGiovanni Bechis
 

Semelhante a Open ssh cheet sheat (20)

SSH for pen-testers
SSH for pen-testersSSH for pen-testers
SSH for pen-testers
 
Introduction to SSH
Introduction to SSHIntroduction to SSH
Introduction to SSH
 
Using Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should KnowUsing Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should Know
 
Ssh
SshSsh
Ssh
 
Ingite Slides for InSpec
Ingite Slides for InSpecIngite Slides for InSpec
Ingite Slides for InSpec
 
Linux Interview Questions and Answers.pdf
Linux Interview Questions and Answers.pdfLinux Interview Questions and Answers.pdf
Linux Interview Questions and Answers.pdf
 
Chef Hack Day Denver
Chef Hack Day Denver Chef Hack Day Denver
Chef Hack Day Denver
 
How to increase security with SSH
How to increase security with SSHHow to increase security with SSH
How to increase security with SSH
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network client
 
Windowshadoop
WindowshadoopWindowshadoop
Windowshadoop
 
Linux Workshop , Day 3
Linux Workshop , Day 3Linux Workshop , Day 3
Linux Workshop , Day 3
 
OpenSSH tricks
OpenSSH tricksOpenSSH tricks
OpenSSH tricks
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopBuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec Workshop
 
Intro to SSH
Intro to SSHIntro to SSH
Intro to SSH
 
Melbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpecMelbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpec
 
cisco
ciscocisco
cisco
 
SSH how to 2011
SSH how to 2011SSH how to 2011
SSH how to 2011
 
3. intro
3. intro3. intro
3. intro
 
Compliance as Code: Velocity with Security - Fraser Pollock, Chef
Compliance as Code: Velocity with Security - Fraser Pollock, ChefCompliance as Code: Velocity with Security - Fraser Pollock, Chef
Compliance as Code: Velocity with Security - Fraser Pollock, Chef
 
OpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeOpenSSH: keep your secrets safe
OpenSSH: keep your secrets safe
 

Mais de Piyush Mittal

Mais de Piyush Mittal (20)

Power mock
Power mockPower mock
Power mock
 
Design pattern tutorial
Design pattern tutorialDesign pattern tutorial
Design pattern tutorial
 
Reflection
ReflectionReflection
Reflection
 
Gpu archi
Gpu archiGpu archi
Gpu archi
 
Cuda Architecture
Cuda ArchitectureCuda Architecture
Cuda Architecture
 
Intel open mp
Intel open mpIntel open mp
Intel open mp
 
Intro to parallel computing
Intro to parallel computingIntro to parallel computing
Intro to parallel computing
 
Cuda toolkit reference manual
Cuda toolkit reference manualCuda toolkit reference manual
Cuda toolkit reference manual
 
Matrix multiplication using CUDA
Matrix multiplication using CUDAMatrix multiplication using CUDA
Matrix multiplication using CUDA
 
Channel coding
Channel codingChannel coding
Channel coding
 
Basics of Coding Theory
Basics of Coding TheoryBasics of Coding Theory
Basics of Coding Theory
 
Java cheat sheet
Java cheat sheetJava cheat sheet
Java cheat sheet
 
Google app engine cheat sheet
Google app engine cheat sheetGoogle app engine cheat sheet
Google app engine cheat sheet
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
Css cheat sheet
Css cheat sheetCss cheat sheet
Css cheat sheet
 
Cpp cheat sheet
Cpp cheat sheetCpp cheat sheet
Cpp cheat sheet
 
Ubuntu cheat sheet
Ubuntu cheat sheetUbuntu cheat sheet
Ubuntu cheat sheet
 
Php cheat sheet
Php cheat sheetPhp cheat sheet
Php cheat sheet
 
oracle 9i cheat sheet
oracle 9i cheat sheetoracle 9i cheat sheet
oracle 9i cheat sheet
 

Último

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 

Último (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 

Open ssh cheet sheat

  • 1. OpenSSH Quick Reference Protocol SSH protocol 2, 1 NumberOfPasswordPro mpts Allow the number of password tries 3 Author: Jialong He StrictModes check files ownership and perm. yes Jialong_he@bigfoot.com SyslogFacility Syslog facility code AUTH http://www.bigfoot.com/~jialong_he TCPKeepAlive Send TCP keepalive to other end yes TCPKeepAlive Send TCP keepalive to client yes VerifyHostKeyDNS Verify the remote key using DNS no UseDNS lookup client DNSname yes What is OpenSSH and where to get it CheckHostIP Check the host IP address in the yes Compression Compress network traffic yes known_hosts file OpenSSH is a protocol suite of network connectivity tools that replace telnet, ftp, rsh, and rcp. It encrypts all traffic (including passwords) to X11Forwading Permit X11 forwarding no effectively eliminate eavesdropping, connection hijacking, and other network-level attacks. OpenSSH comes with most Linux distributions. Public Key Authentication Use command “ssh -V” to check the SSH version installed. The latest Client Configuration Public key authentication is a preferred method. It is more secure than password authentication because no password travels through the network, version can be found from: www.openssh.org ssh (sftp, scp) are OpenSSH commands to replace telnet, ftp, rcp. The but you have to do some setup before you can use public key properties of these program are controlled by (1) command line options, authentication. Public key authentication is configured for individual user. Server Configuration (2) per user configuration file $HOME/.ssh/config and (3) system wide configuration file /etc/ssh/ssh_config. sshd is the OpenSSH server (daemon). It is controlled by a configuration (1) Modify SSH server’s configuration file (sshd_config) to enable public file sshd_config which normally resides in /etc/ssh directory. You can key authentication: (PublicKeyAuthentication yes). Also modify client’s Usage Example: specify command-line options to override their configuration file configuration file (ssh_config) to use public key authentication ssh user@remotehost # connect to remote host as user equivalents. Here are some useful options. For the complete list of (PubkeyAuthentication yes). Normally, these are default settings. scp myfile user@remotehost:/home/user # remote copy “myfile” keywords, see sshd_config (5) manual page. (2) Generate a key pair for this user Keyword Description Default Here are useful keywords in ssh_config. For the complete list of keywords, ssh-keygen –t rsa –f $HOME/.ssh/id_rsa see ssh_config (5) manual page. AllowGroups Allow only specified groups to * connect. May use '*' and '?'. Keyword Description Default It will prompt you a passphrase to encrypt private key. Two files “id_rsa” Default host to connect none and “id_rsa.pub” will be generated. AllowUsers Allow only specified users to * HostName connect. May use '*' and '?'. User Default user name none (3) Transfer user’s public key (id_rsa.pub) to SSH server and append its DenyGroups Groups NOT allowed connecting. none PreferredAuthentications Preferred authentication methods see left contents to: hostbased, publickey, password $HOME/.ssh/authorized_keys or $HOME/.ssh/authorized_keys2. DenyUsers Users NOT allowed connecting. none AllowTcpForwarding TCP forwarding allowed. yes HostbasedAuthentication Try hostbased authentication no You may also restrict from which computers allowed to use public key PubkeyAuthentication Try Public key authentication yes authentication. For example, in authorized_key file, you put “from” before GatewayPorts Allow other computers to connect no the public key. to the forwarding port. PasswordAuthentication Try password authentication yes from=”Goat.domain.com” AAAAB3NzaC1yc2EAAA …. HostbasedAuthentication Allow host based authentication no LocalForward Specify TCP port forwarding in none (use .shosts or /etc/shosts.equiv) LPORT RHOST:RPORT (4) Now you can log on to remote system with ssh my_sshserver IgnoreRhosts Ignore per user .rhosts and .shosts yes RemoteForward Remote forward port none in hostbased authentication. RPORT LHOST:LPORT It will prompt you passphrase to decrypt the private key. If you did not IgnoreUserKnownHosts Ignore $HOME/.ssh/known_hosts, no GatewayPorts Allow hosts other than this host to no give a passphrase in the step 2, you will be connected with asking use only /etc/ssh/ssh_known_hosts connect to the forwarding port password. PasswordAuthentication Password authentication allowed yes ForwardX11 Forward X11 connection no (5) If you do give a passphrase to protect private key, but don’t want to PermitEmptyPasswords Allow blank password no Compression Compress network traffic no type this passphrase every time, it is possible to use ssh agent command: PublicKeyAuthentication Public key authentication allowed yes CompressionLevel If use compress, compress level 6 eval `ssh-agent` AuthorizedKeysFile Public key file name. Default: see left ssh-add ~/.ssh/id_isa $HOME/.ssh/authorized_keys Port Default remote port 22 This will prompt you passphrase once. As long as the current terminal is ListenAddress IP address to accept connection 0.0.0.0 Protocol SSH protocol 2, 1 open, you can connect to the SSH server without typing passphrase. Note, Port Listening port 22 StrictHostKeyChecking Allow connect to a host which is ask this is only valid for the current terminal, you still need to type passphrase LogLevel sshd verbosity level info not in $HOME/.ssh/known_hosts in other terminal. or /etc/ssh/ssh_known_hosts PermitRootLogin Allow root login yes In order to run scripts without typing password, the easiest way is to use a LogLevel Verbosity level info blank passphrase in step 2. Unlike password, passphrase never travels PrintLastLog Print last login date yes through the network. It is used for protecting local private key. PrintMotd Print /etc/motd file yes
  • 2. Host-based Authentication TCP Port Forwarding Hosted based authentication can be useful to run batch files or scripts on OpenSSH can forward TCP traffic through SSH connection and secure remote computers. It is very tricky to configure host based authentication. TCP applications such as POP3, IMAP or HTTP by direct clear text TCP Even if you follow the instructions exactly, you might still get a password traffic through SSH (tunneling). Port forwarding can also redirect some prompt. In this case, double check file permissions (.shosts) and computer TCP traffics through firewall. names (must use FQDN). Restart computer (in order to have sshd read configuration file). In order to use port forwarding, you must first establish SSH connection and the connection must stay on as long as forwarding needed. In other words, you have to logon on to SSH server. There are two kinds of port Server Side forwarding: local and remote forwarding (1) Modify /etc/ssh/sshd_config to enable host based authentication: HostbasedAuthentication yes Local Forwarding IgnoreRhosts no In local forwarding, application servers (e.g., mail server) are on the same IgnoreUserKnownHosts no # optional computer as the SSH server. For example, suppose we have a server named RhostsAuthentication yes # optional, not recommended “horse” and it has web and SSH servers running. On another computer named “goat”, using following command forwards traffic to an arbitrarily Let SSH daemon to re-read configuration file by either reboot the chose port (here 12345) on “goat” to port 80 on “horse”, computer or send “kill –HUP /var/run/sshd.pid”. On Redhat Linux, you can restart SSH daemon using: service sshd restart ssh –g –L 12345:horse:80 horse (2) Copy client’s public key to the SSH server. Client’s public key usually If you point a web browser to http://goat:12345, it will show the contents stored in /etc/ssh/ssh_host_rsa_key.pub on client computer. of http://horse. Here “-g” means that other hosts can access this forwarding port (here 12345). Similarly, you can forward other TCP traffic (e.g., POP3 If client also has OpenSSH server running, you can fetch its public key by: 110, IMAP 143) through SSH tunnel. ssh-keyscan –t rsa client_FQDN > /etc/ssh/ssh_known_hosts2 If per user known hosts is enabled (IgnoreUserKnownHosts no), you Remote Forwarding connect to the client’s SSH daemon from the server, the client’s host key will be saved in: $HOME/.ssh/known_hosts If your application server is on the same machine as SSH client (i.e., you run SSH client on the application server), you should use remote Note: You MUST use FQDN of client computer to get its public key. forwarding. For example, we have a server named “horse” and client Following files are used to store client’s public key on the server. named “goat”. On “horse”, you run System wide: Per user: ssh –R 12345:horst:80 goat /etc/ssh/ssh_known_hosts $HOME/.ssh/known_hosts /etc/ssh/ssh_known_hosts2 $HOME/.ssh/known_hosts2 You can point your web browser to http://goat:12345, it will show the content as if you accessed http://horse. This time, you can only access port (3) Add client’s FQDN in $HOME/.shosts. Please note the permissions for “12345” on “goat” (no Gateway port). this file must be owned by the user and NOT writable by group/others. If (RhostsAuthentication yes), you can also use /etc/hosts.equiv, but this is NOT recommended. Besides, it has NO effect for root login. Client Side (1) Enable host based authentication in SSH client configuration file: /etc/ssh/ssh_config HostbasedAuthentication yes (2) You should have RSA host key pair (normally in /etc/ssh) ssh_host_rsa_key ssh_host_rsa_key.pub If not, generate key pair with: ssh-keygen –t rsa –f /etc/ssh/ssh_host_rsa_key –N “”