-->

DEVOPSZONES

  • Recent blogs

    How to Easily create password-less authentication for Root user amazon linux in AWS

     SSH (Secure SHELL), an open-source and highly regarded network protocol, is used to log in to distant servers so that commands and programmes can be run there. A secure copy (SCP) command and Rsync command are used to move files from one computer to another across a network.

    In this article, we will show you how to set up password-less login on amazon linux. 

    Password-less refers to a remote server login that doesn't require a password. It'll function with a public key. SSH Password-less login is one of the finest ways to automate operations like automatic backups with scripts, synchronising files using the SCP command, and remote command execution if you work with a lot of Linux remote servers.

    Step 1: Create Authentication SSH-Keygen Keys on Source Server

    First login into source server  with user ec2-user and generate a pair of public keys using the following command.

    $ ssh-keygen -t rsa

    Step 2: Upload/Copy SSH Key to Destination  server

    The ssh-copy-id command is useless since you do not have direct root access to the destination server. Please copy the contents of the destination server's ".ssh/authorized keys" file into the source server's "/root/.ssh/id rsa.pub" file.

    Please eliminate any lines that begin with "no-port-forwarding" or "no-agent."

    Step 4: Change the SSH Config

    Change the /etc/ssh/sshd_config file with following:


    1. PermitRootLogin yes

    2. AllowUsers ec2-user root


    The restart ssh deamon with:

     # systemctl restart sshd


    Step 4: Test SSH Passwordless Login from source

    From this point forward, you won't need a password to log into the destination server as root.

    # ssh root@<destnation server ip>



    No comments