ssh to Web Host from static IP works -- will fail if change to dynamic IP?

Folks:

Opening an OS X terminal window and uttering

% ssh <my user_name>@<my_sitedomain>

has worked flawlessly for me for years. I depend on plain old ssh to maintain sites.

BUT, my ADSL service is static IP, for which I pay a premium. I'd like to change to cheaper dynamic IP service.

I'm vaguely aware that ssh security requires the host to recognize my client IP address before granting access. Is this correct?

If so, it seems that SSH will no longer work if I try to connect from a different IP address for each session, which is what will happen with the cheaper service. Right?

Is there a way to continue using SSH as before after I switch to dynamic IP service?

My web host service (bluehost) supports two alternative web-based SSH clients, but I've had real difficulties working with these -- they don't seem to connect reliably at all. I suppose if there is no choice I would have to figure out why these are failing...and hopefully find a fix.

But I would 'druther use plain ssh if at all possible.

Q1: Is there a way to use plain ssh with dynamic IP?

Q2: If so, how?

Q3: Is there anything special I might do to verify this method before changing over to dynamic IP service?

TIA,


Henry

Intel iMac, Mac OS X (10.4.9)

Posted on Jun 23, 2007 1:37 PM

Reply
13 replies

Jun 23, 2007 3:05 PM in response to Hen3ry

Hi, Henry
Using ssh from a dynamic IP address works just fine but you have to use password authentication.
There's an interesting site here discussing a possible way to get around this limitation, but I haven't tried it out.

If you want to verify for yourself that ssh really works with a dynamic IP, you could visit a friend who buys internet access from a major carrier. Their IP address is most likely dynamic; I think you'll be able to do all you need.

I hope that helps!
Caleb

iMac g3 400MHz

Jun 23, 2007 4:34 PM in response to Hen3ry

The problem you're going to have isn't sshing to your web server. It's going to be finding it when it moves around.

Most hosted sites use static IP addresses so that you can use a consistent name and get to the site. If you're using a dynamic IP address, that address may change over time, making it hard to keep up with where it is.

Unless someone has gone out of their way to block SSH to unknown client iPS there isn't any issue with the SSH side of things, just with the web.

How do you propose keeping track of where your site is if you're on a dynamic IP?

Jun 23, 2007 5:19 PM in response to Hen3ry

...or register for a free dynamic DNS host name with dyndns.com and download their dynDNSupdater application to install on your computer. Then you would connect to hen3ry.dyndns.com or whatever you chose from their many domain names for your host name, and since dynDNSupdater keeps their dns server apprised of changes in your public IP address, no problem. These guys also offer a number of paid services in which you may be interested.

Insofar as you logging in via ssh, you will get a warning message saying that your new IP address has been added to ~/.ssh/known_hosts on the remote client, but that's about it. I've been using dyndns for nearly three years.

Jun 23, 2007 5:34 PM in response to Camelot

Thanks for your post.

Doesn't

% ssh <my user_name>@<my_sitedomain>

take care of the issue, because <my sitedomain> is resolved via DNS? As long as the site doesn't change IPs significantly faster than the DNS databases are updated, it seems to me that finding my web server isn't going to be a problem at all. I shouldn't care if the hosting service shifts my web site IP address around.

I think this is getting a bit confused. The only change I'm worried about is IP address of my initiating client. It is static now, and SSH works flawlessly --even though the web site did change IP addresses once or twice.

TIA,

Henry

Jun 23, 2007 5:38 PM in response to j.v.

Thanks for your post.

I think the web host takes care of the DNS for my website, so I don't need to worry about that at all.

Is this the confusion: Some people think I'm hosting a website now on a static IP and I'm worried about what will happen if I go to dynamic IP service? That would worry me, but it isn't at all the issue here, as I have no desire to host sites -- let the pros take care of that.

I'm just trying to anticipate ALL potential problems I might encounter switching from static to dynamic IP with my ISP, and at the top of a short list is whether my ssh access will continue without problems.

Thanks,

Henry

Jun 23, 2007 5:43 PM in response to Ken Nellis

I set up a cron job on the dynamic IP site that
checks its IP address every hour and e-mails me what
it is when it changes. Frequently, mine will go for
maybe a week between changes, although sometimes I
get hourly reports. You can always adjust the
frequency of your cron job if this is a problem.


Thanks for your post, which introduces a slightly different wrinkle, I guess.

Is it possible that my Web Hosting Service is using dynamic IP? I do NOT think so.

Seems to be two kinds of "dynamic":
1) the kind you get with cheaper aDSL (say) when each session is started with an assignment of a temporary IP address to the client system.

2) the kind you get when a Web Hosting service moves your site's IP address around for their convenience. Presumably this is done seldom --no more than once a year-- and the changes are reported automagically through DNS servers. Doesn't seem to be the same problem at all, right?

Thanks,

Henry

Jun 23, 2007 11:50 PM in response to Hen3ry

Oh! I thought you were asking about the gotchas involved with setting up a website on a dynamic IP address like on your home computer, and ssh'ing into it remotely for maintenance, like when you were on business travel or something -- NOT maintaining a website on some webhost's server someplace and wanting to ssh into your shell account there from home in order to maintain the site. So never mind about the dyndns stuff.

As Caleb, Gnarlodius, et.al, have stated or suggested, the website host isn't going to care what IP address you are ssh'ing into your shell account from. Dump the static IP and save yourself a few buck$.

And as Caleb suggested, as a test, got a friend with a Mac? Got one at work? Got an Apple store nearby? Pay them a visit, launch Terminal.app, and ssh to your shell account. Different IP address than at home, right? That would prove it to you.

(There could be one "gotcha" with such a test and that would be if the website/shell account host was also your internet provider. Conceivably, they could restrict shell account access to their servers to only come from IP addresses within their own block of IP addresses, so if you had a failure with this test, you'd want to use a friend's computer that had the same ISP as you do. But I've never heard of any ISP doing that. But think about it -- ssh was made to facilitate connections and protect traffic across the untrusted internet while preventing unauthorized access.)

(As an additional sidenote, I have my own little very-small-scale mail and file server -- itself on a dynamic IP address -- courtesy of the dyndns stuff I mentioned earlier -- running at home for the benefit of family members, the majority of which no longer live here. They tunnel their afp, imap, and smtp connections through secure shell (only my upstream MTA/MX agent is permitted access to my smtp port). They are all on dynamic IP addresses. When I am on business travel, Lord only knows what IP address I'll get at some hotel someplace. But I get in to my home computer via ssh no problem. It'll be no different with your webhost/shell account provider. Yes, the IP address that I, and any authorized remote client users have, gets logged, just as they will log yours.)

Again, bottom line? Save a few buck$. Dump the static IP.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

ssh to Web Host from static IP works -- will fail if change to dynamic IP?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.