How to open a ssh port?

Asked by tashi

Hello,

I'd like to open a ssh port (22) to connect on my machine, so that having the pass for my personal account I could login from elsewhere on my machine. Could someone tell me how to make it? I'm sure it is possible, I've even been explained the way to do it, but I can't remind the way to proceed now... I remember I had to modify things in /etc/, but I can't remember which files...

Could someone please tell me how to make it? For your information, my System is a Ubuntu 9.10, and I'm connected to the Internet by wlan1 (but I think that my interface does not change anything!).
Thank you to help me for this, and good bye!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
tashi
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

sudo apt-get install openssh-server

This wil give you the server. You will need to port forward the port 22 on your router so you can connet from the internet. I suggest you change the port used to something else for security

Revision history for this message
psemaganda (psemaganda-gmail) said :
#2

There is one more thing you need to worry about after setting up the openssh-server username and passwd.
To be able to access your computer remotely, you will have to either use DynDNS or static ip address.
You will only use DynDNS if you get your IP from a DHCP like a residential internate service, once you know what you static IP is, you setup you client once and for all.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

There is no openssh username and password, you connect with your own account you log onto ubuntu with.

You can also use www.no-ip.com for free, ubuntu also has the noip2 package which will send IP updates to the service and make sure your account is up to date if your WAN IP lease expires and your connction gets a different IP address. Some routers will accept dyndns accounts in their hardware setup also which is nice.

Revision history for this message
tashi (pierre-mirmont) said :
#4

Hey, thanks a million guys!
But ... actually I'm trying to open a ssh port on my machine, and it did work but doesn't want to work anymore! So I simply have a Ubuntu, and I'm looking for the command to launch to have a sshd server running, even automatically if possible.

And thanks for the name, because I downloaded openssh-server, and I found back the sshd server. I've even tried to launch it with the "-t" option just to test, and it did work a short time! But now I've typed "killall sshd" to remove the running process, and so it does not work any-more... I've tried anyway to relaunch it, but it does not want to work anymore now...

Could someone tell me a command to launch for a sshd server to run on my machine, to allow me to log in from elsewhere? (knowing my IP of course)

Anyway, thanks for your help, now even yet I can remind, and have the sshd server installed on my machine, great advance!

Revision history for this message
Ed S (edgar-b-dsouza) said :
#5

To start an installed OpenSSH service, you use:
sudo /etc/init.d/ssh start

To stop the service, use:
sudo /etc/init.d/ssh stop

Is this what you were looking for?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

the openssh-server is on the repo so doesn't need "downloading" as such but will be installed by software-center (weird american spelling ahoy)

and will be automagically configured to autostart at bootup

Revision history for this message
tashi (pierre-mirmont) said :
#7

Ok, thanks!

Now I managed to install a ssh server on my machine, great!
But I still wonder about one thing: How to make it launch with my machine, at it's start?

Should I simply add a line with "/etc/init.d/ssh start" somewhere inside /etc/rc.d?

Anyway it works now, thanks a billion!

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#8

The openssh-server by default adds itself to the startup items

Revision history for this message
tashi (pierre-mirmont) said :
#9

Yeah!

Wonderful, it starts automatically! But... I just wonder how it launches itself? By a link in /etc/rc2.d, or something like this? Anyway, I'm going to find late, thanks for your helps!