Solved

Setup a SSH public key in linux

Posted on 2013-11-04
7
624 Views
Last Modified: 2013-11-23
Hi, I am new in Linux. Per this email :

anyone with Sudo privileges on a server  will have to login remotely with SSH public key authentication, instead of using a password.   I'd suggest you set up a public key soon.

Could you please help  me on this ? I need to set up a public key. I am using Putty for SSH connection.

Thanks
0
Comment
Question by:roozbehdec
7 Comments
 
LVL 14

Expert Comment

by:comfortjeanius
ID: 39621881
You can check this link out to see if it helps.

Howto Linux / UNIX setup SSH with DSA public key authentication

If you want to use RSA instead DSA just type:

ssh-keygen -t rsa
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 39622196
ThomasMcA2 - I deleted your comment because it is known as a 'blind' link, just pointing to another site without any explanation or further details is not really helping.

http://support.experts-exchange.com/customer/portal/articles/1162518-using-off-site-content-on-experts-exchange

gerwinjansen
Topic Advisor
0
 
LVL 13

Expert Comment

by:Daniel Helgenberger
ID: 39622917
Hello roozbehdec,

to make a long story short: SSH keys are like the name says, like real keys - but a file. There are always two parts; your private key, which you need to keep secret and protected with a password, and your public key, which can be handed over to anyone. The trick: your key can encrypt a message which only the public key can decrypt and vice versa. This way, a host knows it is you (or at least your key).

In linux, there are basically these files:
ls -1 ~/.ssh
authorized_keys  # < this file holds public keys allowed to log in as this user on the local system, optional
config           # < this file holds general as well as host specific configs, optional
id_rsa           # < this is your private key! protect it well, mandatory
id_rsa.pub       # < your public key, the contents needs to be put authorized_keys of the remote host, optional
known_hosts      # < list of fingerprints of hots perilously connected to prevent man-in-the-middle-attacks, optional but commonly there

Open in new window


To generate your keys and create the keys and log in with ssh keys, open a command prompt on your local computer:
$ ssh-keygen       # interactively creates id_rsa and id_rsa.pub; RSA is the default here nowadays
$ ssh-copy-id username@reomtelinuxhost # enter your password; your public key gets copied in authorized_keys in 'username's home folder on the remote host; enter the password one last time
# now test things
$ ssh -t username@reomtelinuxhost # here you will need to enter the password for the key
$ and connect for real:
$ ssh username@reomtelinuxhost

Open in new window


Note, SSH with PKI is considered as very secure and should always be used with sensible accounts like root.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Accepted Solution

by:
roozbehdec earned 0 total points
ID: 39657472
0
 

Author Comment

by:roozbehdec
ID: 39657480
Those links helped me to solve my issue.
0
 

Author Comment

by:roozbehdec
ID: 39657496
Please close this question.
0
 

Author Closing Comment

by:roozbehdec
ID: 39671097
Those links helped me to solve my issue.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now