Skip to contentSkip to conversation

Connecting externally via SSH

DISCUSSION Eve Atley 2 participants 4 messages Feb 25, 2004

lore
Share & tools
lore

Eve Atley

author
#0 lore raw

Hi folks,

I'm trying to open up our Linux box for external SSH connections. We have a shared T1 line with another company. I know the DNS addresses, and it was indicated I should peek at the /etc/hosts.allow and /etc/hosts.deny files. So... what next? Do I add our DNS address as an SSHD entry and all is hunky dory? I tried this using the DNS address, and the server keeps asking for some password along with my own password.

- Eve

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 8 lines · Eve Atley

Hi folks,

I'm trying to open up our Linux box for external SSH connections. We have a shared T1 line with another company. I know the DNS addresses, and it was indicated I should peek at the /etc/hosts.allow and /etc/hosts.deny files. So... what next? Do I add our DNS address as an SSHD entry and all is hunky dory? I tried this using the DNS address, and the server keeps asking for some password along with my own password.

You are going to have to clarify the bit about "the server keeps asking for some password along with my own password". For that matter, I am not very sure of the "this" that you "tried", what you mean by "an SSHD entry", and what you mean by "our DNS address" (the server's IP address, perhaps?) either.

Do you mean that you ssh to the server from some remote host, and you get two different password queries? If so, is the one for "my own password" the first or the second of them? What is the EXACT wording of the other one?

To make the server available for ssh connections, you need to do, roughly, the following:

1. Install and run an sshd daemon. The sshd process itself needs a public-private keypair, and if the install process doesn't generate one automatically, you'll need to do that, using ssh-keygen .

2. Have entries in /etc/hosts.allow and /etc/hosts.deny that are consistent with the sshd daemon accepting connections from whatever host you want to connect from.

3. Make sure you have no firewalling in place (at either end) that blocks sshd connections from wherever you are connecting from to the server.

4. Decide on authentication scheme -- standard userid/password is the easiest -- and make sure sshd is set up to use it (in its config file, probably /etc/ssh/sshd_config).

5. Make a connection using a compatible ssh client (there are many). The first time you do this, you may get a warning from the client that this is a new host you are connecting to, so you can confirm that you want to make the connection. If you get that message -- it is asking you to accept receipt of the server's public key, in effect -- say YES. Then is should ask you for a regular Unix password.

Having written this outline, I surmise that you are getting the "new host" confirmation message in (5) and mistaking that confirmation request for a request for "some password". The other possibility is that you are using keypair authentication for users, and you are being asked for the passphrase that protects your (user-level) private key ... but that would be instead of, not in addition to, your regular password.

In any case, if this ramble doesn't give you the clue you need, please post a followup in which you descirbe things more completely and exactly, and I'll see if I can help.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

author
#2 lore raw

Ray and others,

Sorry, I should have explained more thoroughly. My SSHD Daemon is already installed, and I have had users generate key pairs using a combination of OpenSSH for Windows and WinSCP3, in order to connect to our RH9 Linux server from their home computers. I am not certain if the SSH daemon itself has a key pair assigned to it - where might I check this and how?

In my testing, I ran everything internally only, assuming I could jump to external connections later as I learned more about SSH. Therefore, I am able to connect internally after setup using the aforementioned client, and after some fanagling, getting key pairs to work. In this case, I set up the keys in each user's directory, their default start directory.

What I didn't realize, and have since figured out as of my last email, is that for external connections, /etc/hosts.allow must have entries for EACH IP address for which we will open external secure shell access. IE, if my external is 180.169.32.123, then an entry in hosts.allow would read as
SSHD: 180.169.32.123

So far so good. I am no longer being asked for a mystery password. However, now I am being asked for my directory password; I want to be asked for my key pair passphrase instead, and am never prompted for such. Where might I find - or put, after creation if none exists - a key pair for this external connection? Does this still reside in each user's directory? I am not sure of this since the fingerprint is entirely different from the ones I *thought* I knew. Where does this one come from?

Thanks,
Eve

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#3 lore raw
Quoted 7 lines · Eve Atley

Ray and others,

Sorry, I should have explained more thoroughly. My SSHD Daemon is already installed, and I have had users generate key pairs using a combination of OpenSSH for Windows and WinSCP3, in order to connect to our RH9 Linux server from their home computers. I am not certain if the SSH daemon itself has a key pair assigned to it - where might I check this and how?

If you are getting ANY response from sshd, then you have a server keypair created. It is what sshd uses at the very beginning of the connection. But to answer the question you actually asked ... it should be wherver your other ssh config stuff is ... probably /etc/ssh/ ... in a pair called ssh_host_?sa_key and and ssh_host_?sa_key.pub (where ? = d or r, depending on which type of key you chose to use ... or you may have both).

Quoted 5 lines

In my testing, I ran everything internally only, assuming I could jump to external connections later as I learned more about SSH. Therefore, I am able to connect internally after setup using the aforementioned client, and after some fanagling, getting key pairs to work. In this case, I set up the keys in each user's directory, their default start directory.

Does "internally" mean you are running an ssh client on the same server that runs sshd? Or does "internally" mean from a different host on the LAN (rather than the Internet)? In the rest of my response, I'll assume you meant the first.

Quoted 5 lines

What I didn't realize, and have since figured out as of my last email, is that for external connections, /etc/hosts.allow must have entries for EACH IP address for which we will open external secure shell access. IE, if my external is 180.169.32.123, then an entry in hosts.allow would read as
SSHD: 180.169.32.123

Nah. That's one way to do it, but not the best, unless you want to allow connections from a very small number of machines. Read "man 5 hosts_access" for the other options. Personally, I wouldn't use hosts control for ssh; I'd use SSHD: ALL in hosts.allow .

Quoted 3 lines

So far so good. I am no longer being asked for a mystery password. However, now I am being asked for my directory password; I want to be asked for my key pair passphrase instead, and am never prompted for such.

When you say "directory password", do you mean your normal Unix password? (If not, what do you mean?) Below, I assume this is the case.

Quoted 3 lines

Where might I
find - or put, after creation if none exists - a key pair for this external connection? Does this still reside in each user's directory?

Yes, unless you change the sshd config file to something different (see one of the excerpts below). That is, you put the public-key half in the file $HOME/.ssh/authorized_keys; the private half stays on the client end (and I believe that usual practice is to generate these keypairs on the clients, then put only the public-key halves on the server.)

Quoted 3 lines

I am not sure
of this since the fingerprint is entirely different from the ones I *thought* I knew. Where does this one come from?

I don't know what this means ... neither these two sentences as a whole nor the specific "this" in the second one.

In the sshd config file (probably /etc/ssh/sshd_config), what authentication options did you enable? To do passphrase authentication (not the right technical term, BTW), you need to enable (say "yes" for) one or both of these:

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys

Similarly, the ssh client needs to have one or both of these enabled in (probably) /etc/ssh/ssh_config . If both sides do not have a usable key-based authentication method enabled and keys present, and the server does allow userid/password authentication via --

# To disable tunneled clear text passwords, change to no here! PasswordAuthentication yes

-- then authentication will failover to userid/password.

The man pages for ssh and sshd cover all of this stuff pretty well, BTW. I referred to them a couple of times in writing this, to get details I tend to forget, like exact file names, right.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs