how to install ssh service in linux

hello,I am new in linux and want to know how to install ssh service in my computer so that others can connect to it,thank you!

what distro are you using? installation depends on the installed distro.

ubuntu

Debian based distro's use apt-get to install packages.
To install the SSH server use this command:

sudo apt-get install openssh-server

and likewise to install the SSH client the following command:

sudo apt-get install openssh-client

alternatively you could use one of the graphical frontends. Ubuntu installs Gnome as default desktop environment, so you could use the Synaptic package manager (System > Administration > Synaptic Package Manger). there is even the Add/Remove tool under the Applications menu.

To install any package, first find its name

aptitude search <service name>

Then use

apt-get install <package name>

I'm using debian lenny on a wireless network behind a linksys ADSL router. just using a text interface (bash). I am using a manual tcp/ip configuration with fixed ip.

I tried apt-get install openssh-server and i get the following output.

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package openssh-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package openssh-server has no installation candidate

This is the second time I tried, The first time I tried I think the message may have been different. maybe package not found at the end sorry but I'm not certain about that, didn't write down the message.

I eventually found my way to /etc/apt.sources.list and noticed http://security.debian.org/ I could ping this address no problem.

So I am not sure where to go from here. I actually have another thread in the tcp/ip forum where I question whether my tcp/ip configuration is complete.

have a look for the right installation target with:

sudo apt-cache search ssh

this should bring you the name of the package (something like "ssh..."). after that use the command mentioned by the other posters to install the package.

Thanks, ok I did that and the following output as returned, which doesn't look too encouraging. If this is normal, then I can probably figure it out.

auth2db-filters - Auth2db defaults filters pack
ctorrent - BitTorrent Client written in C++
libss10.9.8 - SSL shared libraries
openssh-client - secure shell client, an rlogin/rsh/rcp replacement

hmmm... looks strange. i don't know if the packages are in the same repository. maybe you need to check your sources in /etc/apt/sources.list

Yep, it's definitely missing the openssh-server package. Could you post your /etc/apt/sources.list? The entry for the security updates isn't enough to install software.
Also, what's happening if you do apt-get update or aptitude update?

Here is my sources.list...

# deb cdrom:[Debian GNU/Linux 5.0.2a _Lenny_ -Official i386 NETINST Binary-1 2$

#deb cdrom:[Debian GNU/Linux 5.0.2a _Lenny_ -Official i386 NETINST Binary-1 20$

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

I don't have the net install cd in the drive
there was an abortive attempt to connect to the mirror I guess during install, which failed because of network issues.
As mentioned I can ping security.debian.org no problem.

I can't try apt-get update or aptitude update right now, I'll try it later today if sources.list doesn't give us an answer.

This is my first attempt at package management. I haven't tried aptitude yet. wiki.debian.org seems the best place to go for documentation, so I'll be looking into apt and aptitude today.

Thanks.

You're missing the URL for the main repository. Do this:

$ echo "deb http://http.us.debian.org/debian lenny main contrib non-free" >> /etc/apt/sources.list
$ echo "deb http://non-us.debian.org/debian-non-US lenny/non-US main contrib non-free" >> /etc/apt/sources.list
$ apt-get update
$ apt-get install openssh-server

This will add 2 main repositories, update the package list, and install openssh-server. Note: the '$' is not part of the command line but indicates the prompt.

Thanks I'll be able to deal with that this evening, and I'll post back with the results. I'm curious, does the fact that sources.list was missing information suggest something went wrong with my install, or is adding this information as you describe a normal part of the process?

The missing entry is a sign for an install gone wrong (although I'm not sure which step is responsible for that). It was possibly caused by the network issue you mentioned. But as long as you add those lines, it won't cause a problem later on.

ok, there are some tcp/ip - domain name issues here. I cannot resolve either us.debian.org or non-us.debian.org. I can resolve debian.org and security.debian.org no problem

This all applies equally to my linux box and to my windows laptop.

I'll be looking into it from my end also.

---------- Post updated at 03:10 PM ---------- Previous update was at 02:21 PM ----------

never mind. I mistakenly thought http://http. etc was a typo, in fact I confirmed from debian documentation that it is not. So after fixing my sources.list exactly the way you showed, the install seems to have worked fine. I still couldn't resolve non-us.debian.org, but that didn't seem to hinder the download, even though I am from Canada.

Seems like non-us.debian.org has been down for a while... I probably should check my own sources.list more often. It was originally used for software that the US considered to be "weapon grade" (encryption, ...), and which was available only outside the US. (Linky)

As for the main server: According to the mirrors list there isn't a Canadian server, including a statement why there are enough servers already around the world.