Question:
Configure SSH in Linux?
Jake S
2009-08-11 07:15:14 UTC
I have been trying to figure out how to set up SSH on my home computer running Ubuntu Linux so I can access it from my laptop while at school or any other network. I have been searching the forums, help guides, and tutorials, but none of them have the all of the information that I need and trying to piece the little help that I have found together just leaves me more confused.

What I would like to know is
1-- How to set up SSH so I can access my computer from a different network and also
2-- Learn how to use SSH, not just set it up.
Nine answers:
2009-08-11 07:20:33 UTC
Place>Connect to Server



Service Type: SSH

Server: IP Address of the computer you're connecting to

Port: 22

Username: Whatever you set (It's usually root by default)
Peter
2009-08-11 07:38:33 UTC
There are entire books written to solve this one question. ;-)



But maybe I can send you to the right places.



Your first question is reasonably straightforward.



First, you need to install and configure SSHD if you haven't already. Configuring isn't a big deal, it should probably do that yourself. But simply open up Synaptic (the package manager) in Ubuntu and find the SSHD package (might be called "openssh" or something like that). Make sure it's installed.



You should then be able to SSH into your computer by going to a command line (Terminal) and typing "ssh localhost". If you can't then you will need to determine if the ssh daemon is running and if it needs to be configured or anything. Head to Google or linux forums, these can help a lot with that sort of thing.



Once you have SSH working locally, you will need to forward the port on your router (so your router knows which computer is hosting SSH on your network. This is pretty easy. Just head to this handy website [1] and look up your router. You will need to forward TCP connections on port 22 to your linux computer.



Once you have that set up, head to this site [2] and find out your external IP address. Then head to a coffee shop or school (you probably cannot do this from home because of the strange routing involved) and try to SSH to the IP address you found at [2]. It will be something like "ssh 12.34.56.78".



Now, you should note that the IP address you got will not work forever. It might change every couple days/weeks/hours. In order to be sure you always know what your IP address is, use a service like dyndns.com. They will give you a client to install on one of your computers so that you have an address like "myhomecomputer.dyndns.net" that always resolves to your IP address. You can SSH into that address to access your computer from school.



Now, for your second question, there are a million things you can do with SSH. Although a classic favorite for high school students is a SOCKS proxy. You can use PuTTY (stored on a USB drive or anywhere else) to create an "SSH tunnel" to your home computer. You then set up a browser (such as firefox portable, also storable on a USB drive) to use the tunnel as a SOCKS proxy. This will allow you to surf the internet without going through that pesky internet filtering software. ;-) [3]
silman
2016-10-01 08:23:27 UTC
SSH isn't a information superhighway server protocol lol you could deploy an opensource equipment, openssh, although this would possibly not upload linux instructions to XP -- you ought to use DOS instructions by the telnet shell (secured by SSH) in spite of the undeniable fact that.
mgerben
2009-08-11 07:25:13 UTC
1. install it on ubuntu. You need the server and it is not installed by default. Open the installer, find 'ssh-server' and install that package.



2. test it. From another computer in your network, you should be able to log in to your machine using ssh.



3. configure router. Port 22 has to be forwarded to the machine you want to access.



4. Test it from the outside.
Synful Visions
2009-08-11 07:20:01 UTC
1. Forward port 22 on the router to the host running SSHd.



2. Start SSHd.



3. Connect.



Actually using SSH is no different than doing a CLI session on the machine.
Boberelli
2009-08-11 07:38:46 UTC
I have some questions too,



Is SSH installed?

Did you generate a certificate for it?

Is there a firewall running on the Linux machine?



Good luck.
Gerardo_C
2009-08-11 07:22:16 UTC
I used this website when I first started learning SSH, might help you out as well: http://principialabs.com/beginning-ssh-on-ubuntu/
Jeff P
2009-08-11 07:22:37 UTC
It's not that difficult. This guide is about as easy as it gets. If you can't figure it out, then you should practice some more basic Linux apps and commands.
koppe74
2009-08-11 08:00:15 UTC
First off, unless you have a static IP address, you'll need some dynamic DNS service (like dyndns.com). You register your name and a password, and choose a name for your computer/site/network. Then you run a daemon on your linux-box (ddclient) that periodically finds the (dynamic) IP address currently assigned to your broad-band modem by you ISP (the IP address other computers see your broad-band modem as), and then log-into the dynamic DNS service and match this IP-address to the name you selected. By using this name when you want to log into your computer, it doesn't matter if your ISP has just changed your IP.



Then you need to configure your firewall to accept SSH through. This may be just the firewall on you linux-box, but you may also have to configure the firewall setting in your router (e.g. a 3Com Wireless Router) and/or a dedicated firewall. SSH uses port 22, but you may at this point concider using a non-standard port, as this will make it difficult for sniffers looking for open SSH-access (just remember to start your sshd on the non-standard port).



In /etc/sshd there are files were you can specify which users can -- or can't -- access (log in) through ssh. You want to ban "root" for sure. Beware though, that due to other subsystems (like PAM), the files and setting you need to change is not obvious. I changed ssh.allow, only to discover that this had been moved into another file, and that ssh.allow was no longer used (on my system).



You may also concider blocking the use of passwords, and use keys instead. In SSH you can create a key-pair (similar to PGP), and use them as a more secure and restictive way of authentication than password. Of course, you'll need to copy one of the keys to your laptop.



Add sshd to the servers to be started at your default runlevel (e.g. create a symbolic link from /etc/init.d/sshd to /etc/rc.5/S90_sshd ).



+++



SSH can also allows you to copy files through scp (secure copy) and sftp (secure file transfer protocol), and you don't need to run any other server than sshd on your computer.



SSH can also be used to run X clients on your linux-box at home, and display the result on an X-server on another computer (e.g. your laptop). Start an X-session on your laptop, and in an xterm use SSH to log-in into your home-computer. If you start any X-clients in the xterm, they will be run on your home-computer, but their "windows" will be shown on your laptop.



You can also use SSH as a tunell, to create a secure channel to virtually any service. E.g. you can run a web-server on your home-computer which is inaccessable from the outside (due to firewall), but still access it remotely by going through SSH (which could be the only service you allow remote access to).



If you want to access your home-computer from Windows with SSH, PuTTY is an excellent program. It can also be used to make tunells for other programs to your linux-box (like programs for remote-controlling your computer).





Good luck.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...