Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

Access EC2 Linux Instance via the Password

Posted on 09/03/201817/08/2026 Christian By Christian No Comments on Access EC2 Linux Instance via the Password
  1. Home
  2. AWS/Azure/OpenShift
  3. Access EC2 Linux Instance via the Password
Diagram illustrating data transfer from a computer to AWS cloud storage with a penguin icon, labeled 'TechDirectArchive,' alongside the Amazon EC2 logo.

An Amazon EC2 instance is a virtual server in Amazon’s Elastic Compute Cloud (EC2) for running applications on the Amazon Web Services (AWS) infrastructure. In this article, we will describe how to access EC2 Linux Instance via the Password. Please see Create Folders and Enable File sharing on Windows, How to deploy Ansible AWX on centos 8, how to determine Tombstone Lifetime in Active Directory, and how to setup and configure a Lamp stack on CentOS.

Access EC2 Linux Instance

The default username for CentOS instance (on AWS) is: centos. In CentOS use the below,

  • sudo su in changing to a root user or
  • Sudo su <username>

This article assumes that you have a running EC2 Linux Instance. Please see How to create an EC2 Instance.

Step 1: PuttyKeyGen

After creating an instance start the PuttyKeyGen. Click on Load

Screenshot of the PuTTY Key Generator interface displaying options to generate a public/private key pair, load an existing private key file, and save generated keys.

By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types.

Dropdown menu displaying options for file types, including 'Private Key File (.pgg)' and 'All Files (.C)'.

Now you should be able to view the keyfile download from the instance containing the public.

Choose Save private key to save the key in the format that PuTTY can use. PuTTYgen displays a warning about saving the key without a passphrase. Choose Yes.

Here is how to Install and configure Ansible on Azure Virtual Machine, and How to change the system time zone under RedHat and CentOS.

Step 2: Launch Putty

Enter the connection name or IP and select port 22

Screenshot of PuTTY configuration window displaying session options including Host Name, Port, and Connection type settings.

To have the private key entered. Expand Connection, expand SSH, and then choose Auth and choose Browse.

Screenshot of the PuTTY Configuration window showing SSH authentication options and settings.

Now click on Open, you should be able to access the server. The default username for CentOS is centos

Steps 3: Create user password

To create a password for this user, edit the sshd_config setting and save it

vi /etc/ssh/sshd_config
change the PasswordAuthentication value as yes
PasswordAuthentication yes
:wq (means save and exit)

Step 4: Restart SSH service

To restart the SSH service, use the command(s) below.

service sshd restart
or
/etc/init.d/sshd restart

Step 5: Add a user Account

To add a user account in order to connect to the EC2 instance via a username and password on CentOS

Step A: To add a user to the system, issue the useradd command to create a locked user account:

#useradd <username>

Step B: Unlock the account by issuing the passwd command to assign a password and set password aging guidelines:

passwd <username>

This must be the same user name in step A above. After this criteria has been met, then you should be able to set the password

Terminal command output showing user administration commands including 'useradd' and 'passwd', with prompts for changing a user's password.

Now: Connect a new session and test with the user account created.

Add a user as a Sudoer on CentOS

Note: Because certain action can only be performed by Linux Administrators on Linux.

This makes the root by default have access to whatsoever on the Linux Machine. Since we have the root user account disabled, we will create a new user account and add the user to the Sudoer file thereby granting him all privileges he needs.

Procedure for Adding a Sudoer

  • Steps 1: First Create a user account and the steps can be found in this document above
  • Step 2: The file in Linux that determines if you are eligible to execute the Sudo is called “Sudoers” and this can be found in this location /etc/sudoers

But it is not recommended to modify this file as it is detrimental! Why is it so? This is because any syntax error found in this file could affect the entire system. So there is a unique used called visudo

[root@ip-11.1.1.22]# visudo
After running this comment, use “i” to insert and search for the file (this will prompt the sudoer file for editing (modification)
## Allow root to run any commands anywhere
Below this you will see lines like (Add the username and permission as the root user) as shown in the screenshot below, e.g,
[username] ALL=(ALL) ALL
Text-based configuration file displaying permissions for root user in a command-line interface.

I hope you found this article on how to access EC2 Linux instance via the password very useful. Please feel free to leave a command below.

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
AWS/Azure/OpenShift Tags:AWS, EC2, EC2 instance, EC2 Instances

Post navigation

Previous Post: AWS Flow Logs IAM Role Setup
Next Post: How to setup and configure Jitsi as SoftPhone

Related Posts

  • EC2
    How to Add and Format a New Virtual Disk to an EC2 Instance AWS/Azure/OpenShift
  • ouath2final 1 e1786835965613
    How to implement Interactive Authentication using MSAL dotNET AWS/Azure/OpenShift
  • amazon ec2 multiple ips 1
    What to note before assigning Multiple IPs’ to an Instance AWS/Azure/OpenShift
  • ARI Banner e1784558934898
    Azure Resource Inventory (ARI) for Engineers: Improving Control and Compliance AWS/Azure/OpenShift
  • AADSTS50020 User from Identity Provider does not exist in Tenant
    AADSTS50020: User from Identity Provider does not exist in Tenant AWS/Azure/OpenShift
  • WCD
    Join Bulk Devices using a Provisioning Package to Azure AWS/Azure/OpenShift

More Related Articles

Azure App Service How to Restore Deleted Azure App Service Using PowerShell Automation
Azure logo 1 Azure Active Directory: Why do I need to deploy Azure AD? AWS/Azure/OpenShift
azure file share feature image Deploy Legacy App to Azure Fileshare AWS/Azure/OpenShift
HYBRID BENEFITS FEATURE Azure Hybrid Use Cases and Benefits AWS/Azure/OpenShift
Webp.net resizeimage 5 How to Improve Website Response Using Traffic Manager AWS/Azure/OpenShift
powershell01 3 How to install and Update Azure PowerShell on your Windows PC AWS/Azure/OpenShift

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

Top 30 Sysadmin blog

veeaam100

Veeam Vanguard

  • Remove icons from Launchpad
    Remove an icon from launchpad that has been deleted Mac
  • WAMPServer Virtual Host
    How to create Virtual Hosts in a WAMPserver Web Server
  • Slide2 2
    Oracle VirtualBox: Installing Windows 11 without TPM Support Virtualization
  • IIS8
    How to add an account to the local IIS_IUSRS group Windows Server
  • fast user switching in windows 10 1
    Fast user switching: How to create a desktop shortcut in Windows 10 to switch User Accounts Windows
  • How to Solve Parameter is Incorrect problem on External Hard Disk
    How to Solve “The parameter is incorrect” problem on External Hard Disk in Windows Windows
  • Google drive Mount issue fixed 1 e1785328171798
    Google Drive Broken on Windows: Fix and Prevent it from happening again Windows
  • On ubuntu mariadb
    How to install MariaDB on Ubuntu Linux

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,747 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Contact
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon
  • Bsky

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.