Connect two local linux computers via ssh - linux

I would like to know how to connect two linux computers (Ubuntu and OpenSuse) via SSH. When I try to run this command on Suse:
ssh 192.168.1.37
I get error:
ssh : connect to host 192.168.1.37 port 22 : connection refused.
When I try to connect from Ubuntu PC with the same command and Suse's IP, I get "connection timeout" error.
Any help would be appreciated.

Install SSH server in the machine you want to connect, by issuing the command:
sudo apt-get install openssh-server -y
After that, you can connect to that machine by executing the following command:
ssh user#ip_address
where user is the name of the user in that machine you want to connect to with which you want to be authenticated, and ip_address is the IP address of that same machine.

When logging in, try to specify the user you want as well, so that the command looks something like this
ssh example#192.168.1.37

Try using this if its default user
ssh root#192.168.1.16
ssh root#device_ip_address
root is the default user for dietpi

Try the following command by specifying the username followed by # and the IP address (i.e. the hostname).
ssh user#192.168.1.1
Here, user is the username of the user in the machine you want to connect to, followed by the IP address of the host, which in this case is 192.168.1.1.

Related

Problems to create ssh tunnel from Windows to Ubuntu with VNC

I have Windows (client) and Linux (server).
I want to have a VNC access over ssh to Linux.
I use Port 2222 as ssh port.
I managed to install the ssh and login to the linux server via ssh using public key without password.
I have tried several configurations via windows console, which also work:
ssh -l user -L 5901:localhost:5901 xxx.xxx.xxx.xxx -p2222
OR
ssh -L 5901:127.0.0.1:5901 user#xxx.xxx.xxx.xxx -p2222
But when I try to go in via VNC viewer (Windows) with xxx.xxx.xxx.xxx:5901, the connection is interrupted.
I change the default "sshd_config" to:
AllowTcpForwarding local
X11Forwarding yes
Port 2222 at ufw is open.
Which mistake I make?
Is the port 5901 right to use?
From the fact that you are doing ssh port-forwarding, I understand xxx.xxx.xxx.xxx:5901 is not directly accessible from your Windows machine.
Can you try to go in via VNC viewer (Windows) with localhost:5901, after setting up ssh as follows ?
ssh -X -L 5901:127.0.0.1:5901 user#xxx.xxx.xxx.xxx -p2222

How to connect to remote server using linux ssh tunel command

I have an easy-one here, I'm new using linux to connect to other linux server, the issue is that on a remote server which I can reach from my vpn, I have a GUI running on the port x.x.x.x:6500
I did not have any problem using putty/xshell to make a tunnel to the server and then to see the GUI in my laptop using the localhost:6500.
I'm trying to do the same on my Manjaro VM but I'm having troubles to see the GUI since there. The page says connection refused...
I'm using the following command:
$ ssh -L 6500:127.0.0.1:6500 x.x.x.x -v
Maybe the command is wrong, that's not the correct syntax?

SSH Tunnel to Ngrok and Initiate RDP

I am trying to access my Linux machine from anywhere in the world. I have tried originally port forwarding and then ssh'ing in; however, I believe my school's WiFi won't allow port forwarding (every time I ran it, it would tell me connection refused). I have setup an account with ngrok and I can remotely SSH in, but now I am wondering if it is possible to RDP. I tried connecting via the Microsoft Remote Desktop app on Mac, but it instantly crashes. I have also looked at trying to connect with localhost, but it's not working. So far, I have tried (with xxxx being the port):
ssh -L xxxx:localhost:xxxx 0.tcp.ngrok.io
and
ssh -L xxxx:localhost:xxxx <user>#0.tcp.ngrok.io
but my computer won't allow it and after about 2 or 3 times, it warns me of a possible DNS Spoofing. Is there anyway that I can run a remote desktop of my linux machine that I have ssh tunneled to (from my mac) on ngrok? Thank you!
First you'll need to sign up with ngrok if you haven't already and you'll be given an authtoken. You'll need to install this by running
./ngrok authtoken <insert your token here>
This will save your token to a file located ../username/.ngrok/ngrok.yml
Then you'll need to ask ngrok to create a TCP tunnel from their servers to your local machine's Remote Desktop port which should be 3389 by default
ngrok tcp 3389
Give it 30 seconds or so then jump to http://localhost:4040/status to see what the tcp address ngrok has allocated you. It should look something like tcp://1.tcp.ngrok.io:158764
Now you should be able to remote into your machine using address 1.tcp.ngrok.io:158764

Setup ssh to connect 2 PC and use MPI

I am here because I've found different problems setting up SSH using this guide proposed in this other question.
First of all I've a computer (I want to use it as master) called: timmy#timmy-Lenovo-G50-80. My other computer is a Virtual Machine always with linux mint called: test#test-VirtualBox and I'd like to use it as a slave.
What I've done until now is:
install needed packets (both PC):
sudo apt-get install openssh-server openssh-client
Change inside the file /etc/ssh/sshd_config: (Only master)
the port of server from 22 to 2222
set PubkeyAuthentication yes (so no change)
remove comment at line: Banner /etc/issue.net
STOP
I am stuck when I've to execute this command:
ssh-copy-id username#remotehost
I imagine, reading what's written, that I've to execute something like:
ssh-copy-id timmy#timmy-Lenovo-G50-80
but:
from timmy#timmy-Lenovo-G50-80 everything goes OK, I can connect to myself (not what I actually want)
from test#test-VirtualBox it tells me ERROR: ssh: Could not resolve hostname timmy#timmy-Lenovo-G50-80: Name or service not known
Finally, what I've to do in order to connect these 2 PC?
You need to enable port forwarding into your VirtualBox'ed machine. Simply right click on the virtual machine, then go into Network. Then click on advance which will expand the Network window, and then on the button that appeared labeled Port forwarding.
A table will appear with several columns (Name, Protocol, Host IP, Host Port, ...). Simply add a new entry for protocol TCP, host port = X and guest port = 22 (see the list of well-known ports here https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports). The screenshot below is from my cloudera quickstart VM. Notice the outlined entry in the port forwarding rules, which is about setting up the SSH port in the guest OS.
Once you reboot the virtual machine, you can simply connect to it through
# ssh -p X localhost
the -p parameter tells to connect through the port X. Notice that if you want to use scp then you have to use the uppercase -P option rather than the lowercase -p.
# scp -P X localfile localhost:remote-dir/

SSH Permission denied for Mininet

I am new to SDN and was trying to learn Mininet. I have installed debian(64-bit) and Mininet on Virtual Box. When I try to connect Mininet Vm from Debian I have to run the following comamnd :
ssh -X mininet#10.0.2.15
It asks for mininet password, but after entering the default mininet password it shows an error
Permission denied please try again
Both my debian and Mininet VM have same IP address. Kindly guide how to eliminate the SSHerror. Also is it fine having same ip address for two different VM, is the SSH error a result of this ?
Thanks
In the VirtualBox settings under the tab Network click on Advanced then Port Forwarding and add a rule with name: ssh, protocol: tcp, host port: 3022 and guest port: 22. Then execute:
sudo ssh -p 3022 mininet#10.0.2.15

Resources