Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Setup a SSH public key in linux

Posted on 2013-11-04
7
Medium Priority
?
637 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:Golchehr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 38

Expert Comment

by:Gerwin Jansen, EE MVE
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Accepted Solution

by:
Golchehr earned 0 total points
ID: 39657472
0
 

Author Comment

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

Author Comment

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

Author Closing Comment

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

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

636 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