Solved

Setup a SSH public key in linux

Posted on 2013-11-04
7
625 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

864 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

24 Experts available now in Live!

Get 1:1 Help Now