LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-17-2008, 07:17 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,328

Rep: Reputation: 54
ssh Key pair whoes


I'm trying to setup keys so that I can have an automatic backup job without password prompts, but I ran into issues. Now it just asks for the pass phrase, so I'm back to square one.... sure I can enter no passphrase but that defeats the whole purpose of security, anyone else can just do ssh-keygen with no passphrase then get on my server.

Also I noticed when I setup key pair then that client can connect to that server and only that server. If I try to connect to another server I get immediatly:

Received disconnect from [host]: 2: Too many authentication failures for [user]

1: So... how do I make the key thing not stop from connecting to other servers? It's retarded if it makes it so I can only connect to one server...

2: How do I make it enter the passphrase automaticly, but still keep security?


Also if I want to be able to set this up for more then one server to connect to, how do I go about doing it? Since I can't enter my own key file, it has to be ~/.ssh/id_rsa so how do I make another pair? Does it just append to those files? or would I reuse the same public key and put on the other servers I want to access?
 
Old 08-17-2008, 08:09 PM   #2
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,328

Original Poster
Rep: Reputation: 54
Decided to use expect instead, been playing with it and it does what I want. Will just be tedious as I need to create an expect script AND backup script for a single job but what I'm doing is writing a C++ program that will take an argument for a job profile and read the info from a text file then generate the required bash/expect scripts, execute them, then delete them. I could probably even go a step further and make it support a basic custom encryption for the password.

The public key stuff was making me nervous anyway, too much obscurity and possibility of a security issue due to something I don't know about.
 
Old 08-17-2008, 08:12 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The passphrase protects the secret key on the client. Without it the secret key is locked (encrypted). You will need it for all of the servers you connect it to. All of the servers should have the same copy of your public key added to their authorized_keys file.

There is a program called "ssh-agent" that can hold your passphrase. You can run it at the beginning of a session like this:
eval $(ssh-agent)
ssh-add
<passphrase is entered>

Now you can connect to an ssh server without re-entering the pass phrase each time. There is also a key ring program as well. It may work better for hands off automation.

You might need to run ssh-keygen to delete the passphrase for automation. The security you will lose is in protecting the secret key on your client. Otherwise you may need to re-enter the passphrase whenever the computer reboots; and keeping the passphrase in a file or script wouldn't be any more secure then the secret key itself.

---

Rereading what I wrote, I'm not certain if I made something clear. From the servers point of view, the same thing happens whether you use a passphrase or not. The pass-phrase is used on the client side only. It is the possession of the secret key that provides the security. The client needs to use the secret key to decrypt a challenge by the server using the public key.

----

I don't know why you need to write a C++ program to perform a backup. That's what cron is for. Also designing you own encryption scheme, in the end may be more vulnerable then using one that cryptographic experts have designed. Remember WEP. WEP stood for Wired Equivalence Protocol, but written by engineers instead of cryptographers, turned out to be very weak.

Last edited by jschiwal; 08-17-2008 at 08:26 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
open-ssh vs. commercial ssh (tru64), public-key auth not possible? cf050 Linux - Networking 8 03-28-2012 11:15 AM
How can I create an X509 .pfx certificate from an existing gpg key pair? stardotstar Linux - Security 0 11-15-2007 06:37 PM
DISCUSSION: Forward ports via an SSH tunnel with auto reconnect (using key pair authentication) merize147 LinuxAnswers Discussion 0 07-24-2006 04:31 PM
mysql whoes Red Squirrel Linux - Software 1 05-07-2005 10:24 PM
internet connection whoes coolbreeze Linux - Newbie 2 12-07-2003 10:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration