Skip to main content

Posts

How to SSH EC2 instance with ssh-agent along with SSH agent forwarding to SSH private instances in VPC?

            Image Source: atulhost.com and modified by me        Hi, I have taken this post from AWS Blog, and this very important to SSH into your VM using ssh-agent and SSH forwarding for EC2 private instance to SSH without storing the private key securely in Windows, Mac, and Linux.  So, I want you to using this as this is very important as per security reasons. Configuring ssh-agent The first step in using SSH agent forwarding with EC2 instances is to configure a bastion in your VPC. We suggest that the instance you use for your bastion be purpose-built and that you use it only as a bastion and not for anything else. The bastion should also be set up with a security group that’s configured to listen only on the SSH port (TCP/22).  Always remember the following when configuring your bastion: Never place your SSH private keys on the bastion instance. Instead, use SSH agent forwarding to connect first to the bastion and from t...

How to Convert PEM KeyFile into PPK KeyFile and vice versa?

Hi, In this post, we will learn that how can we convert PEM KeyFile into PPK KeyFile and vice versa including the installation of the tool which we will use to accomplish this. For the Windows Operating System In Windows system is easy and straight forward. You just need a tool called "puttygen.exe" from the URL -  https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html Choose the appropriate version as per your OS. Convert PEM into PPK in Windows After downloading the PuTTYgen and open it, load your file (select All Files (*.*) in the bottom dropdown to select your PEM key file).  You will get a message Successfully imported foreign key, Just click OK, Now click on Save private key button to save that key in the location where do you want to save it. Convert PPK into PEM in Windows Now we will convert PPK file into PEM using PuTTYgen in Windows PC Open the PuTTYgen tool, now load your PPK file into it, and finally, Go to Conversions Menu and Click on Export OpenSSH k...

Google Cloud Storage Command-line Utility [GSUTIL]

GSUTIL Command-line utility for Google Cloud Storage Create Bucket (Including Storage Class, Location) gsutil mb -c [storage class] -l [location] gs://bucket-name Remove Bucket  gsutil rm -r gs://bucket-name Parallel multi-threading copy  gsutil -m cp -r . gs://bucket-name Turn on versioning on bucket (get details of versioning enable or not)  gsutil versioning get gs://bucket-name Set versioning off gsutil versioning set off gs://bucket-name Enable the versioning gsutil versioning set on gs://bucket-name List all version of a file gsutil ls -a gs://bucket-name Long listing format generation and meta-generation gsutil ls -al gs://bucket-name Changes the storage class of a object in a bucket  gsutil rewrite -s NEARLINE gs://bucket-name/* Change the storage class of multiple objects (Multi-Threading Parallel)  gsutil -m rewrite -s NEARLINE gs://bucket-name/* Access Control List (ACL) on objects (Public access to the general public) gsutil acl ch -u AllUsers:R gs:...

How to transfer Google Cloud Storage One account data to Google Cloud another account?

                                                          Image Source: infiflex.com Step 1: Go to the account where storage bucket are resides. Select the Select the Bucket, you want to transfer data and Click on SHOW INFO PANEL on the Top Right. Step 2: Under PERMISSIONS click on Add members. Now type the email id of the another account where you want to transfer all of your files in New Members Box. Select Role Storage > Storage Admin. Step 3: Now, Go to second account, Go to your storage bucket and select and repeat the last steps but this time email id will be the 1st account email id. All Set. Step 4: Finally Go to First account open the Google Cloud Shell and run the following command - gsutil -m cp -r gs://SOURCE-BUCKET-NAME /* gs://DESTINATION-BUCKET-NAME /

Setup and Configure AWS CLI on EC2 Instances

For Linux Systems Prerequisites:  You must ensure that you have at least Python 2 version 2.6.5+ or Python 3 version 3.3+ installed. To verify your current version, run the command: python --version Installation: The recommendation for installing the AWS CLI is to use the bundled installer provided by AWS. The bundled installer includes all dependencies required for the installation.  Step 1. To begin the installation run the following command: sudo curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" Step 2. Next, you must unzip the downloaded package from step 1: sudo unzip awscli-bundle.zip Step 3. Once the package in unzipped, you can run the installation: sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws Using the -b option allows all users to use the AWS CLI from any directory, meaning you will not need to specify the install directory in the user’s $PATH variable.  Step 4. Check the installed version /usr/local/b...

How to create users for your EC2 Instance that can connect securely via ssh

Public and Private Keys for AWS Users Create a normal user in AWS sudo adduser username How to add user in sudo group or wheel group sudo usermod --groups sudo --append username Allow user to run the sudo command without asking the password root ALL=(ALL) ALL username ALL=(ALL) NOPASSWD:ALL Or you can add complete sudo or wheel group. The users under sudo or wheel group run sudo command with asking password to sudo users %wheel ALL=(ALL) NOPASSWD:ALL %sudo ALL=(ALL) NOPASSWD:ALL To switch to the user directory cd /home/username Run the following command inside the user home directory to generate keys ssh-keygen - b 4096 -f username -t rsa To create the .ssh directory under user home directory mkdir .ssh Give permission to the owner to read, write and execute (700)  chmod 700 .ssh To store public key in authorized_keys file (after exit from the username   ) sudo cat username .pub >> .ssh/authorized_keys so that the owner can read and write to the file  chm...

How to remove Let's Encrypt SSL Certificate from CentOS 7 - 8

Please follow the steps to remove the Let's Encrypt SSL Certificate: First take a backup of letsencrypt directory under /etc - sudo cp -r /etc/letsencrypt/ /etc/letsencrypt.backup I deleted the ‘no longer needed domains’ in the three folders… rm -rf /etc/letsencrypt/live/${DOMAIN} rm -rf /etc/letsencrypt/renewal/${DOMAIN}.conf rm -rf /etc/letsencrypt/archive/${DOMAIN}