Search code examples
pythonamazon-web-servicesjupyter-notebookputty

PuTTy AWS no such file or directory


PuTTy AWS no such file or directory

  • 1 - created the ec2 instance at AWS ubuntu
  • 2 - downloaded the key (.pem file)
  • 3 - since Im using windows, I downloaded PuTTy
  • 4 - generate a putty file
  • 5 - Im logged in with Putty (login as: ubuntu Authenticating with public key "imported-openssh-key" )

  • 6 - Now need to run:
cd path/to/my/dev/folder/
chmod 400 JupyterKey.pem
ssh ubuntu@11-111-111 -i JupyterKey.pem

# Doesn't work!!


so Im conected to putty and now Im trying open the key(automation.pem) to conect with server AWS to start build my jupyter notebooks

# First attempt

[ec2-user@ip-111-11-11-111 ~]$ cd \Users\pb\Desktop\pYTHON\AWS\server

-bash: cd: UserspbDesktoppYTHONAWSserver: No such file or directory


# Second attempt

[ec2-user@ip-111-11-11-111 ~]$ ssh -i "imported-openssh-key" ubuntu@ec2-54-67-50-191.us-west-1.compute.amazonaws.com

Warning: Identity file imported-openssh-key not accessible: No such file or directory.
The authenticity of host 'ec2-ip-111-11-11-111.us-west-1.compute.amazonaws.com (ip-111-11-11-111)' can't be established.
ECDSA key fingerprint is 11111111111111111111111111111111111111111111111111111.
ECDSA key fingerprint is 11111111111111111111111111111111111111111111111111111.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ec2-11-111-111.us-west-1.compute.amazonaws.com,11-111-1191' (ECDSA) to the list of known hosts.
Permission denied (publickey).
[ec2-user@ip-172-31-28-150 ~]$



Solution

    1. Your cd command did not work because in Linux like files systems the directory seperator is a / and not a . A \ indicates that it's a special character \n for newline or \r for carriage return. Also Linux like file systems are case sensitive.

    I say Linux Like because this applies to just about everything except Windows, including the Windows Linux Subsystem, Mac's, Any Unix flavor (Linux, BSD, etc...)

    1. In your second attempt there is no file named imported-openssh-key in your current directory. You need to have the file with the key in the directory you are trying to use ssh with the -i option.

    The more typical way to use ssh is in your home directory (You can get to it with cd ~ in most linux like systems) You create a directory called .ssh and store your keys in there and configure a file to know how to access them.

    Also I believe there is now native SSH support in Windows, so you probably don't need to jump through the putty hoops anymore.

    If the key file isn't on the server you will need to copy it to the Ubuntu server using scp

    Hope this helps