Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts

Sunday, December 4, 2022

Convert a putty .ppk key to an Amazon .pem file on Mac

$ brew install putty

$ puttygen key.ppk -O private-openssh -o key.pem

Or,

$ openssl x509 -in certificatename.cer -outform PEM -out certificatename.pem

Friday, October 21, 2022

How to upload local file to Linux server through Mac SSH terminal

scp /path/to/file username@servername/ip:/destination/folder/

scp /Volumes/HDD/yourfilename.zip root@ip/server:/var/www/yourdirectorypath/public



To copy a file from the local server to the remote one:

scp FILENAME user@remote_server:/remote/path/FILENAME

To copy a file from the remote server to the local one:

scp user@remote_server:/remote/path/FILENAME /local/path/FILENAME


Sunday, September 11, 2022

Make PPK to Pem using Mac terminal

sudo port install putty
or
brew install putty


This will also install puttygen. To get puttygen to output a .PEM file:
puttygen privatekey.ppk -O private-openssh -o privatekey.pem

Once you have the key, open a terminal window and:
ssh -i privatekey.pem user@my.server.com

The private key must have tight security settings otherwise SSH complains. Make sure only the user can read the key.

chmod go-rw privatekey.pem

Saturday, August 27, 2022

How to create authorized_keys file in linux with ssh folder

 ls -a | grep .ssh

mkdir ~/.ssh/

touch ~/.ssh/authorized_keys

sudo nano ~/.ssh/authorized_keys

Thursday, August 25, 2022

How to add public key to authorized_keys ec2 instance Ubunutu Linux

 Step 1: Login into you AWS account and go to EC2 instances

Step 2: Select your instance and click connect

Step 2: Then click connect button at the bottom right corner

Step 3: Now a new tab will be opened with console as follows

Step 4: Copy your SSH public key then add the key to the following key file

Use this command in Mac/Windows powershell to copy your public key: pbcopy ~/.ssh/id_rsa.pub

nano ~/.ssh/authorized_keys

Step 5: Save and reboot then try to connect again with device from which public key generated.

Thursday, August 18, 2022

How to add SSH Public key to an existing Droplet or VM?

First copy your Public key using the following command: 

cat ~/.ssh/id_rsa.pub

or 

pbcopy ~/.ssh/id_rsa.pub

Now login into your Droplet or VM and open the following file then paste your public key into authorized_keys file.

nano ~/.ssh/authorized_keys


Save the file and try to login from your local terminal.

Tuesday, November 23, 2021

How to use Siteground SSH in MacOS terminal

On Siteground the steps are as follows:
Logon to your account at Siteground.
Open Site Tools for your website.
Go to Devs = SSH Keys Manager.
Enter a Key name (e.g. privatekey)
Generate a Password
Click the Create button.
Go to3dots=Manage IP access to limit the IP addresses that can use this connection.
Go to3dots= Private Key and copy it to your clipboard.
On your local machine, open your preferred Terminal
Browse to /path/to/your/privatekey
Create new file, call it myschool and paste the Private key.
Run the following commands
chmod 600 privatekey
ssh-add privatekey
Back in the Site Tools = SSH Keys Manager, go to3dots= SSH Credentials to discover the username and hostname to use.
Now you can run the following command, in order to gain SSH access

ssh username@privatekey -p12345

Tuesday, August 3, 2021

How to generate SSH keys in Mac OS

To generate SSH keys in Mac OS X, follow these steps:

1. Enter the following command in the Terminal window.ssh-keygen -t rsa
This starts the key generation process. When you execute this command, the ssh-keygen utility prompts you to indicate where to store the key.

2. Press the ENTER key to accept the default location. The ssh-keygen utility prompts you for a passphrase.

3. Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase). However, this is not recommended.
Please note that you will need to enter the passphrase a second time to continue.

After you confirm the passphrase, the system generates the key pair.

Your identification has been saved in /Users/user/.ssh/id_rsa.

Your public key has been saved in /Users/user/.ssh/id_rsa.pub.

The key fingerprint is:

ae:89:72:0b:85:da:5a:f4:7c:1f:c2:43:fd:c6:44:38 user@mymac.local

The key's randomart image is:

+--[ RSA 2048]----+

|                 |

|         .       |

|        E .      |

|   .   . o       |

|  o . . S .      |

| + + o . +       |

|. + o = o +      |

| o...o * o       |

|.  oo.o .        |

+-----------------+

Your private key is saved to the id_rsa file in the .ssh directory and is used to verify the public key you use belongs to the same cloud server. It's important to never share your private key with anyone, it is equivalent of your password!

Your public key is saved to the id_rsa.pub file and it is the key you'll upload to our cloud service. You can save this key to the clipboard by running this:

pbcopy < ~/.ssh/id_rsa.pub

or

cat ~/.ssh/id_rsa.pub


Tuesday, February 23, 2021

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! || SSH

Problem:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:9cw8z+XkMzK09077WQVzFPZllB38LUzW+odbhEp3mm0.
Please contact your system administrator.
Add correct host key in /Users/imac/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/imac/.ssh/known_hosts:14
ECDSA host key for [192.180.251.241] has changed and you have requested strict checking.
Host key verification failed.
olineit-iMac:~ imac$ ssh root@[IP or Hostname]


Solution:
ssh-keygen -R [hostname or IP]

How to get Ranking of the Students in Excel using RANK Function

=RANK(number,ref,[order]) To rank in descending order, we will use the formula =RANK(B2,($C$5:$C$10),0) If we want unique ranks, we can use...