Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Configuration and Authentication using OpenSSH key

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 901
    Comment on it

    Secure Shell (SSH) is a cryptographic network for operating network services securely over an unsecured network. A common example is for remote login into a system by an user. 

    Installation

    Generally it comes already installed in most of the Linux distributions. Or otherwise you can install it with the following command in your terminal. I'm writing here shell scripts for Ubuntu. You may find some syntax change for other distributions but steps are similar.

    sudo apt-get install openssh-server

    Generate PEM file

    If you get chance to work on AWS, you get a pem file to login into your dedicated/virtual server with the ssh with -i parameter.

    ssh -i ~/pem_file_name.pem username@domain_name_or_ip_address_of_aws

    You also can generate the PEM file for your system so that you/your client can login into you machine remotely. To generate the PEM file follow the steps given below.

    Generate the PEM and PUB files with the following shell script. Enter this command to generate 2,048 bit RSA key using verbose (questions asked during) mode, and a public .pem X.509 certificate.

    ssh-keygen -t rsa -b 2048 -v

    You will be asked for a file name, I inserted a name my_pem, it will generate a my_pem.pub file and the my_pem file without file extension, rename it to my_pem.pem, files are created in the current directory you have open in terminal window. You will be asked to enter passphrase, it is for securing the certificate on your local machine, I ignored this option by pressing enter, as it is voluntary option and I feel confident about my local computer security.

    Now it done but when you try with this PEM file, it asks for the password. To fix that, upload the secured key into your openssh server with the following shell script.

    ssh-copy-id -i ~/my_pem.pub your_system_user_name@your_system_ip_address

    That's finally done. You can login into your machine remotely ssh key only with the following script.

    ssh -i my_pem.pem username@xxx.xxx.x.24

    Thanks.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: