unrecognized service when starting ssh
I'm assuming that you've already configured port forwarding and are able to get through to the machine at work.
Otherwise, even after following my answer, you won't get very far.
The SSH server is not installed by default.
You will need to install it by running these commands in a terminal (ctrl+alt+t) on the machine you wish to connect to:
sudo apt-get update
sudo apt-get install openssh-server
Then you will be able to connect normally by running:
#Replace user & IP accordingly
ssh [email protected]
However, in that state you have a security risk.
As Oli has noted here,
You need to harden it from the standard setup. I've gone through several suggestions on my blog but at the very least, I'd suggest:
- Key-based logins. Disable password logins.
- Move it off port 22. Use something crazy-high, in the 20000-60000 range.
- Use
fail2ban
to ban people who do find it and try to brute it.They take about 10 minutes in total and you go from a 1/10000 chance of being broken in to a probability so small, there isn't enough paper in the world to write its fraction... Assuming you're careful with your key, it has a password of its own and you don't trumpet your credentials all over the net.
If the computer is behind a router, you'll also want to do some port forwarding. This is router-specific so I'll just direct you to http://portforward.com
Related videos on Youtube
Meir Zeilig-Hess
Updated on September 18, 2022Comments
-
Meir Zeilig-Hess over 1 year
I'm trying to connect to a remote Ubuntu computer at work via SSH from my laptop running Ubuntu.
At first, I just tried running:
$ ssh work_name@work_machine
But nothing happened.
Searching for a tutorial on the net, I followed the instructions on this page
I suppose I need to activate the possibility for such a connection, so I typed in the terminal on my laptop
sudo service ssh start
After typing my password, I received the following message:
ssh: unrecognized service.
I wish someone could help me understand what should be done for the SSH remote connection to work.
-
Nick Weinberg almost 8 yearsThe ssh service is for running an ssh server; you don't need that on your laptop if you're only using it as a client. Are you able to
ping -c 1 work_machine
successfully from your laptop? Does your work computer have an SSH server installed and configured? Are you able to ssh into your work computer from other machines? -
Meir Zeilig-Hess almost 8 yearsI'm not sure how to use the ping. My work computer now has an SSH server installed. What should be configured, and how?
-
Nick Weinberg almost 8 yearsI'm afraid that SSH server configuration and setting up port forwarding can be a bit complex if you're completely new to networking and the command line; there are plenty of guides online that can explain it much better than I can. You might want to look into a more user-friendly method of connecting to your work computer, such as Teamviewer or Chrome Remote Desktop.
-
-
Meir Zeilig-Hess almost 8 yearsI managed to follow all these instructions until reaching the step of copying the ssh-id after using key-gen. After typing 'ssh-copy-id -p <port_number> work_name@work_device' again nothing happens.
-
You'reAGitForNotUsingGit almost 8 years@MeirZeilig-Hess - Forget about hardening the security for a moment. Can you connect without doing all those steps?
-
Meir Zeilig-Hess almost 8 yearsNo. Same situation - nothing happens after typing 'ssh working_name@working_device'
-
You'reAGitForNotUsingGit almost 8 years@MeirZeilig-Hess - It would seem then that you don't have port forwarding set up correctly.
-
Meir Zeilig-Hess almost 8 yearsMaybe. I didn't understand how to use the port-forward page in the link you put.
-
You'reAGitForNotUsingGit almost 8 yearsLet us continue this discussion in chat.
-
Meir Zeilig-Hess almost 8 yearsOK, I managed to make it. The only one more thing I needed was to connect to the work server before connecting to the work computer. Thank you for all the help!