Solved

Setup a SSH public key in linux

Posted on 2013-11-04
7
626 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
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:
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Mint 18 31 89
Linux hostname change 2 71
issue in getting eth0 IP in oracale virtual box Linux VM 4 51
Fetching data from Multiple Linux Server using Shell Scripting 55 134
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

776 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