LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting up ssh to my home computre (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-ssh-to-my-home-computre-625242/)

billrclarity 03-02-2008 07:02 PM

Setting up ssh to my home computre
 
I would like to be able to contact my home computer from my laptop while on the road. Then I would like to be able to check my email (using the email client on my home system), check stocks, bank stuff, etc. Naturally, I want all this to be on a secure connection since I would be doing this from a Starbucks or some place like that.

My laptop runs SUSE 10.2. My home system runs SUSE 10.1, so we are talking Linux to Linux, probably connecting from the laptop to the home system via ssh, and sshd running on the home system.

The home system connects via a wireless router to my router, which is which connects to my internet provider. The home system connects to the router using DHCP, and the router also uses DHCP to connect to my provider. That means that I can't depend on the knowing the IP address when I connect to my router. I plan to set up the router to port forward the ssh port to the home system.

So, question 1: How can I (dynamically) find out my home IP address so I can enter
> ssh me@<host or IP>
I have heard there are service on the web that can do this, but don't know where to look.

2: What do I have to set up in ssh.config and /etc/ssh/ssh_config in order to make the connections, and allow programs on the home system to use the laptops X server?

I would certainly appreciate information that will allow be to find where the documentation to do this stuff is.

Thanx.

jschiwal 03-02-2008 07:24 PM

You need to forward port 22 on the router to your home desktop. Doing that, it may fix the IP address assigned to the desktop, or use the hostname to re-forward to the new address.
Your router's status page will list the internet address of your router. If you have a router with a built in NAT router port, then you may need to access the routers status page or use "traceroute" to discover it. An always on cable modem may change the IP very rarely. There are dynamic dns services you can subscribe to.

To use X on your laptop, use the command "ssh -X user@host". Also edit /etc/ssh/sshd_config and enable X forwarding.
Also consider changing the port you use from 22 to one above 1024. This will reduce the number of script kiddie attacks. You can change the port number in sshd_config as well. Forward this new port instead of 22 in the router. Then you can either use "ssh -X -p <port #> user@host" or edit the port number in /etc/ssh/ssh_config on your laptop, and /etc/ssh/sshd_config for your desktop.

Also edit sshd_config to only allow protocol 2. Another good idea is to disable root logons and add "AllowUsers <Your User Name>". Root logons are a bad idea. It is a known user and a popular target of attackers. The "AllowUsers" entry will only allow logins from the users listed.

Also note that if your username is different on the two computers, when on the laptop, the user you logon as should be the desktop username not the laptops.

There are manpages for both sshd_config and ssh_config.

jschiwal 03-02-2008 07:33 PM

I forgot that you should run "ssh-keygen" on both systems to generate public and private keys. Log in from one computer to the other to add entries to ~/.ssh/known_hosts.

In /etc/ssh/ssh_config, use either the default "ask" or "no" for StrictHostKeyChecking. Make sure it isn't "no". Also check the permissions on your home directory. Make sure that your home directory isn't world writable.

gilead 03-02-2008 07:49 PM

There's a few different things there. You should be able to get your IP address manually from http://www.whatsmyip.org/. Another way is to use someone like http://www.dyndns.com/ for dynamic DNS and install an update client on your home box so that you only need to remember a name, instead of an IP number.

Once you've done that, you can forward port 22 (or whatever port you run SSH on) from your router to your box. At this point you should be able to SSH to your home box.

I run nomachine NX on my home box. On my remote boxes I have the nx client running so I can run firefox, thunderbird or fluxbox, etc. over the connection. There's also freenx but I haven't tried that.


All times are GMT -5. The time now is 09:11 AM.