EMR ssh on Master node - amazon-web-services

When i do ssh to master node as:
ssh hadoop#masternode -i key.pem
The connection is terminated with message :
Connection reset by peer
Is there anyway to maintain the ssh session for long time?

Try to add this to /etc/ssh/ssh_config:
ServerAliveInterval 60

Related

gcloud compute scp - Connection Failed (Sometimes with 4010 Error Code)

"Connection Failed
You cannot connect to the VM instance because of an unexpected error. Wait a few moments and then try again."
When I tried to copy file from one virtual machine to another using scp, ssh client loses connection. Command that I run is the following:
gcloud compute scp --recurse file_name account#instance_name:~/folder --zone zone_name --project project_name
What can be the reason of it?
Make sure that you have opened port 22, which is the port that allows communication with SSH. If you are not sure, you can create a rule by going to VPC -> Firewall Rules -> port 22.
Here is an article that can help with allowing SSH connection
This other article can help you troubleshooting SSH
You can also run the following command to check which ports you have open netstat -tuplen, make sure you have port 22 listening.

How to connect polkadot.js to the Parastate local node

I'm trying to connect my local node here:
https://polkadot.js.org/apps/
I go to the top left coner and choosing "local node "
However I do not understand where to enter ip and port for my node.
How to do that?
Enable ssh tunneling to the server.
The first step is to enable ssh tunnel from the local host to the remote server where your parastate node has been hosted . The below command enable ssh tunnel to remote host xx.xx.xx.xx on port 9944 which is needed for polakdot.js.org endpoint:
ssh -N -L 9944:127.0.0.1:9944 -i C:\Users\sshkey\privatekey.ppk root#xx.xx.xx.xx
In case you are not using ssh key and would like to connect using traditional method by supplying password, use the below option
ssh -N -L 9944:127.0.0.1:9944 root#xx.xx.xx.xx
The below command enable ssh tunnel to remote host xx.xx.xx.xx on port 9944 which is needed for polakdot.js.org endpoint
ssh -N -L 9944:127.0.0.1:9944 -i C:\Users\sshkey\privatekey.ppk root#xx.xx.xx.xx
In case you are not using ssh key and would like to connect using traditional method by supplying password , use the below option
ssh -N -L 9944:127.0.0.1:9944 root#xx.xx.xx.xx
Enter the password when prompted/
You will just have empty hanging window . Don’t panic you are all good.

Suspending and resuming VM in GCP

I'm having a recurrent problem while using the Google Cloud Platform. To illustrate what's happening I created a new VM, successfully connected to it via gcloud beta compute ssh, and suspended the instance.
After it was suspended, I resumed it, but wasn't able to connect to it via ssh anymore, I ran the command:
gcloud beta compute ssh --zone "us-central1-a" "test-vm" --project "my-project" --ssh-flag="-vvv"
and received the following output:
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/guilherme/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "34.66.57.82" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 34.66.57.82 [34.66.57.82] port 22.
debug1: connect to address 34.66.57.82 port 22: Connection timed out
ssh: connect to host 34.66.57.82 port 22: Connection timed out
ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].
The suspend/resume was done in browser, on GCP's platform.
Because of this problem I have not been able to suspend any VMs, since I "lose" it everytime. Does anyone know how to properly suspend it? Thanks
If there was a change in the setup "gcloud" denies an ssh connection, you must update the ssh keys in your metadata by:
sudo gcloud compute config-ssh
If this complains about different entries in your config file where your ssh key entries are stored, ~/.ssh/config, delete this file and execute the above command again.
If the internal firewall of the system block port 22, you can try the following steps to fix it:
In the GCP Console, go to the VM Instances.
Select the instance and click edit.
Find Custom metadata option and Click Add item and Type startup-script as a key and Copy and past the command sudo ufw allow ssh as a value. This command will enabled port 22 for SSH.
Recommend this topic Troubleshooting SSH for your issue.

Unable to access changed default ssh port on AWS Ubuntu

I've changed default ssh port by performing the following steps;
Edit 22 to 2200 in sudo nano /etc/ssh/sshd_config
restart ssh server by using sudo service ssh restart
Added a ufw rule sudo ufw allow 2200/tcp
Added a rule in EC2 security group in AWS management console to allow TCP 2200 from 0.0.0.0/0
SSH access to public IP using port 2200 and using SSH private key
But it was it was unresponsive.
Any ideas?
You need to restart sshd
sudo service sshd restart
Not the ssh restart because ssh_config controls the behaviour of ssh not sshd

SSH connection issue to AWS EC2 instance

I am using cygwin which has ssh configured.
I am using a windows machine
Path to keypair file : C:\cygwin64\home\suhelkhan.ssh\kworld_kp1.pem
The EC2 instance is Red Hat Enterprise Linux (RHEL) 6
The EC2 is correctly mapped to the keypair
The security group associated with this EC2 instances allows for SSH
connection.
I am using the following command to connect
suhelkhan#DTDVD0003009PR ~/.ssh
$ ssh -vvv "kworld_kp1.pem" ec2-user#ec2-52-63-yyy-zz.ap-southeast-2.compute.amazonaws.com
output:
OpenSSH_7.3p1, OpenSSL 1.0.2h 3 May 2016
debug2: resolving "kworld_kp1.pem" port 22
ssh: Could not resolve hostname kworld_kp1.pem: Name or service not known
Checking with telnet gives the following:
suhelkhan#DTDVD0003009PR ~/.ssh
$ telnet 52.63.141.40
Trying 52.63.141.40...
telnet: Unable to connect to remote host: Connection refused
The Telnet cmd gives out the following:
suhelkhan#DTDVD0003009PR ~/.ssh
$ telnet HOST 22
Can't lookup hostname HOST
I just redid the whole thing (New instance with appropriate security group, Proper Key-Pair match up and new cygwin installation [http://thecoatlessprofessor.com/programming/installing-amazon-web-services-command-line-interface-aws-cli-for-windows-os-x-and-linux-2/ ]) .Also added my Public IP to the inbound tab of the security group i am using.. all works.. thanks for the all the help