Linux Classroom Series – 31/Jul/2020

Constructing SSH Command

  • SSH Command is quite simple
# This will ask password
ssh username@<hostname/ip-address>

# If you are using key based authentication
ssh -i <path-to-key> username@<hostname/ip-address>
  • By default ssh runs on port 22, if ssh runs on any other port (8922)
ssh -p 8922 username@<hostname/ip-address>
ssh -p 8922 -i <path-to-key> username@<hostname/ip-address>
  • To run ssh command we need ssh client
    • In linux & MAC machines we already have terminal with ssh clients
    • Windows:
      1. Latest Windows 10 or windows 2016 server or later: Microsoft has added ssh client and you can use it from powershell
      2. You need to install ssh clients like
        • Git Bash
        • Putty
        • Cygwin
  • There is one file where ssh server configuration will be present on the linux machine (/etc/ssh/sshd_config)
  • Now lets try to create a some user on centos machine
sudo adduser linuxadmin
sudo passwd linuxadmin
sudo usermod -aG wheel linuxadmin
  • Now lets try to generate key pairs on the ubuntu machine for the new user called as linuxadmin
sudo adduser linuxadmin
sudo usermod -aG sudo linuxadmin
ssh-keygen
ssh-copy-id linuxadmin@<centosip>
ssh centosip

Preview Preview Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin