Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1485  / 2 Years ago, thu, december 30, 2021, 1:45:32

I would like to use ssh to access the shell of another Ubuntu computer and issue a few commands. I'm interested in how to form the shh command in the following scenarios. To keep it simple, I will not be using password protected accounts. I would like to focus primarily on command formations that establish the connection.




  • Two local Ubuntu computers directly connected with an Ethernet cable:


  • Two remote Ubuntu computers where each is connected via cable modem (each has it's own ip):


  • Same as previous, but one is using NAT:


  • Two remote Ubuntu computers, where one is connected via a cable modem and the other is connected via a wireless router:


  • Two local boxes connected to the same wireless router:



More From » ssh

 Answers
7

With local Ubuntu boxes, whether they're connected directly or using a switch, you can use hostname.local to connect. So, if your laptop is called bambuntulaptop, then you can connect to it using bambuntulaptop.local.



For non-local connections, you'll have to use an IP address or setup a dns server. You can use ddclient coupled with a service like dyndns.org.



NAT isn't really relevant with regards to ssh. You'll need to forward port 22 to the right machine, or configure your ssh server to use another port and forward that one. Port 22 is the default ssh port.



You must not allow non-protected accounts. There are thousands, or hundreds of thousands of computers who are scanning for things to abuse. Allowing any user on the internet to run programs on your computer is a seriously bad idea. Ubuntu is secure, but not that secure. In fact, I don't think you will be allowed to use non-password protected accounts with ssh. If you wanted to do that, then you'd need to setup keys. That would be another question.



The command to establish the connection itself, could hardly be any easier: ssh username@host. In other words, reusing the example from above; ssh [email protected].


[#40235] Friday, December 31, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tresein

Total Points: 197
Total Questions: 113
Total Answers: 112

Location: Hungary
Member since Wed, Nov 9, 2022
2 Years ago
tresein questions
Tue, Jun 28, 22, 17:57, 2 Years ago
Sun, Apr 3, 22, 07:11, 2 Years ago
Thu, Feb 3, 22, 18:03, 2 Years ago
Sat, May 13, 23, 13:00, 1 Year ago
;