SSH Permission denied for Mininet run in VMvare Workstation - ssh

I am new to SDN as well and was trying to learn Mininet. I have installed ubuntu 18.04 in VMware Workstation and run Mininet in it by 'apt-get install'. When I try to connect Mininet from my local host, I run the following comamnd :
ssh -X mininet#ubuntu 18.04's ip
I entered mininet as passwd but denied. I've tried to modify /etc/ssh/sshd_config and restart my ssh server, but it did'nt work.
I've modified the following 3 items:
1.PermitRootLogin yes
2.PasswordAuthentication yes
3.UseLogin yes
I also have tried:
sudo ssh -p 3022 mininet#my_ip
and could'nt connect.

Related

Can't connect to local hortonworks sandbox with ssh

I've deployed the Hortonworks Sandbox on VirtualBox according to https://hortonworks.com/tutorial/sandbox-deployment-and-install-guide/section/1/ .
Now, I want to ssh to the sandbox. I see this in the shell of the virtual machine:
If you zoom in on the middle of the image, you'll see this:
.
Assuming the IP-adress of the virtual machine to be http://127.0.0.1, I did the following:
$ ssh root#http://127.0.0.1 -p 8888
ssh: Could not resolve hostname http://127.0.0.1: Name or service not known
As you can see, it doesn't work. How come it is not found? I can connect through my browser by going to 127.0.0.1:8888, so clearly, there is something there. Why can't I find it with ssh?
The problem was the ip-address and the port. Changed the command to:
ssh root#127.0.0.1 -p 2222
which solved the problem.

Reverse tunneling in RaspberryPI and cloud server?

I have a Raspberry Pi and and i have done reverse tunneling with an AWS instance. I ran the following command below on my Raspberry Pi.
ssh -N -R 1234:localhost:22 username#instance_IP
and on my Linux instance i am able to ssh using..
ssh -l user_pi -p 1234 localhost
but i am not able to ssh directly into my PI instead i first have to login to AWS and then into my PI..
how can i login to my PI directly using tunneling?
Thanks a lot!!
I found out that in case of direct remote connecting you need to allow Tcp Forwarding
AllowTcpForwarding yes

Vagrant startup with sshpass and port forward not working

I am trying to set up Vagrant for my development environment, but are having problems getting Vagrant to automatically connect to a remote server on startup
In my Vagrantfile I have the following line:
config.vm.provision "shell", path: "vagrant/startup.sh", run: "always"
In my startup.sh I have the following:
#!/usr/bin/env bash
sshpass -p '*******' ssh -fN -L 389:XXX.XXX.XXX.XXX:389 ******#********.*******.**.**
The provision runs on startup, but no ports are getting forwarded
If I SSH into the box and run the command, it just returns without any errors, but doesn't work. I can only get it to work if I don't use sshpass
P.S. Please don't tell me about the insecurity of sshpass, this is only used for LAN connections

How can I connect to a Google Compute Engine virtual server with a GUI?

I am testing a Google Compute Engine, and I created a VM with Ubuntu OS. When I connect to it, by clicking this Connect SSH button, it opens a console window.
Is that the connection you get?
How do I open a real screen with a GUI on it? I don't want the console.
Much better solution from Google themselves:
https://medium.com/google-cloud/linux-gui-on-the-google-cloud-platform-800719ab27c5
You need to forward the X11 session from the VM to your local machine. This has been covered in the Unix and Linux stack site before:
https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-from-ubuntu-machine
Since you are connecting to a server that is expected to run compute tasks there may well be no X11 server installed on it. You may need to install X11 and similar. You can do that by following the instructions here:
https://help.ubuntu.com/community/ServerGUI
Since I have needed to do this recently, I am going to briefly write up the required changes here:
Configure the Server
$ sudo vim /etc/ssh/sshd_config
Ensure that X11Forwarding yes is present. Restart the ssh daemon if you change the settings:
$ sudo /etc/init.d/sshd restart
Configure the Client
$ vim ~/.ssh/config
Ensure that ForwardX11 yes is present for the host. For example:
Host example.com
ForwardX11 yes
Forwarding X11
$ ssh -X -C example.com
...
$ gedit example.txt
Trusted X11 Forwarding
http://dailypackage.fedorabook.com/index.php?/archives/48-Wednesday-Why-Trusted-and-Untrusted-X11-Forwarding-with-SSH.html
You may wish to enable trusted forwarding if applications have trouble with untrusted forwarding.
You can enable this permanently by using ForwardX11Trusted yes in the ~/.ssh/config file.
You can enable this for a single connection by using the -Y argument in place of the -X argument.
These instructions are for setting up Ubuntu 16.04 LTS with LXDE (I use SSH port forwarding instead of opening port 5901 in the VM instance firewall)
1. Build a new Ubuntu VM instance using the GCP Console
2. connect to your instance using google cloud shell
gcloud compute --project "project_name" ssh --zone "project_zone" "instance_name"
3. install the necessary packages
sudo apt update && sudo apt upgrade
sudo apt-get install xorg lxde vnc4server
4. setup vncserver (you will be asked to provide a password for the vncserver)
vncserver
sudo echo "lxpanel & /usr/bin/lxsession -s LXDE &" >> ~/.vnc/xstartup
6. Reboot your instance (this returns you to the Google cloud shell prompt)
sudo reboot
7. Use the google cloud shell download file facility to download the auto-generated private key stored at $HOME/.ssh/google_compute_engine and save it in your local machine*****
cloudshell download-files $HOME/.ssh/google_compute_engine
8. From your local machine SSH to your VM instance (forwarding port 5901) using your private key (downloaded at step 7)
ssh -L 5901:localhost:5901 -i "google_compute_engine" username#instance_external_ip -v -4
9. Run the vncserver in your VM instance
vncserver -geometry 1280x800
10. In your local machine's Remote Desktop Client (e.g. Remmina) set Server to localhost:5901 and Protocol to VNC
Note 1: to check if the vncserver is working ok use:
netstat -na | grep '[:.]5901'
tail -f /home/user_id/.vnc/instance-1:1.log
Note 2: to restart the vncserver use:
sudo vncserver -kill :1 && vncserver
***** When first connected via the Google cloud shell the public and private keys are auto-generated and stored in the cloud shell instance at $HOME/.ssh/
ls $HOME/.ssh/
google_compute_engine google_compute_engine.pub google_compute_known_hosts
The public key should be added to the home/*user_id*/.ssh/authorized_keys
in the VM instance (this is done automatically when you first SHH to the VM instance from the google cloud shell, i.e. in step 2)
you can confirm this in the instance metadata
Chrome Remote Desktop allows you to remotely access applications with a graphical user interface from a local computer or mobile device. For this approach, you don't need to open firewall ports, and you use your Google Account for authentication and authorization.
Check out this google tutorial to use it with Compute Engine : https://cloud.google.com/solutions/chrome-desktop-remote-on-compute-engine

Connect ipython-notebook via SSH tunnel from a remote location

I'm trying to open an ipython-notebook (which is running on a server) on a macbook from a remote location through an ssh tunnel but no data received.
This is the command for the SSH tunnel
ssh -L 5558:localhost:5558 -N -t -x user#remote-host
and this is the command I used to lunch the notebook form the server
ipython notebook --pylab=inline --port=5558 --ip=* --no-browser --notebook-dir notebooks
Than I tried to open it on a new tab with this remote-host:5558 but no data received.
Thanks in advance!
The directive -L AAAA:somehost:BBBB will cause SSH to listen on port AAAA on localhost (the machine the ssh command is run on) and forward any connection to that port, over the SSH session, to the host somehost port BBBB. So, you need to open http://localhost:5558/ in the browser on the machine you run the ssh command on.
Read this: How do I add a kernel on a remote machine in IPython (Jupyter) Notebook?
Remote jupyter kernel/kernels administration utility (the rk) here: https://github.com/korniichuk/rk