Invalid Password when logging into Jupyter in AWS - amazon-web-services

I'm just starting to work with AWS and I'm working on getting Anaconda set up on my AWS EC2 Instance. The entire set up process worked well but i'm getting stuck with inputting my password in jupyter.
FYI, here is the tutorial I have been using: https://chrisalbon.com/jupyter/run_project_jupyter_on_amazon_ec2.html
I manually changed the password in the ipython config file:
Even when inputting testing123 I get an invalid error message.
Have you guys dealt with this? Any help would be much appreciated.

I think you have understood the whole process but got confused in password section so I am only gonna point out what you did wrong.
Assuming You followed below blog as you said:
https://chrisalbon.com/jupyter/run_project_jupyter_on_amazon_ec2.html
In the section
Create a password for jupyter notebook
1 ipython
2 from IPython.lib import passwd
3 passwd()
4 'sha1:98ff0e580111:12798c72623a6eecd54b51c006b1050f0ac1a62d'
5 exit
I have added the line numbers for the sake of better explanation:
when you write passwd() which is in 3rd line
The AWS expects you to input a password and again ask you to verify the password you have given and then it gives you a SHA version of your password. like on 4th line: 'sha1:98ff0e580111:12798c72623a6eecd54b51c006b1050f0ac1a62d'
Now you have to copy this and keep it with yourself to paste it later in ipython config file.
so you should use below lines in your config to make it work for you:
c = get_config()
# Kernel config
c.IPKernelApp.pylab = 'inline' # if you want plotting support always in your notebook
# Notebook config
c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem' #location of your certificate file
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False #so that the ipython notebook does not opens up a browser by default
c.NotebookApp.password = u'sha1:98ff0e580111:12798c72623a6eecd54b51c006b1050f0ac1a62d' #the encrypted password we generated above
# It is a good idea to put it on a known, fixed port
c.NotebookApp.port = 8888

Related

Returning Environmental Variables

I am working on Corey Schafer's blog tutorial and now setting up 'password reset email' using my gmail account as an email client. I want to store my email and password in an environmental variable but when I verify that the information was properly stored it returns none
In the terminal I used (nano .bash_profie)
export EMAIL_USER='email#gmail.com'
export EMAIL_PASS='password'
Then I verified
import os
user = os.environ.get('EMAIL_USER')
password = os.environ.get('EMAIL_PASS')
print(user)
print(password)
Other commenters on the tutorial suggested...
-restart editor and terminal
-Use .zshrc instead of .bash_profile
I have tried these other recommendations but still it returns none. I am still new to programming so any suggestion is appreciated.
without '
export EMAIL_USER=email#gmail.com
export EMAIL_PASS=password
Set env variables like:
os.environ['EMAIL_USER']
os.environ['EMAIL_PASSWORD']
and then use with:
os.environ.get('EMAIL_USER')
Then could you try sourcing your .bash_profie and then run your python file, you must run both commands within the same shell.
source .bash_profie
python yourpythonfile
If you are using ubuntu, try nano .bashrc instead of nano .bash_profile then follow other instructions as you described.

AWS EMR jupyter password

im using EMR and wanted to use jupyter(ipython) so i added to the cluster the bootstrap action:
s3://elasticmapreduce.bootstrapactions/ipython-notebook/install-ipython-notebook
I performed the port tunelling to access jupyter from my local host and works fine, but it is asking for a login password, tried empty, tried hadoop, but no luck, does any body knows what is the jypyter password?
I ran into this problem as well when I used the same bootstrap action. I tried adding in Args=[--password, jupyter] which I also could not get working. That was from this aws forum:
Name='Install Jupyter notebook',Path="s3://aws-bigdata-blog/artifacts/aws-blog-emr-jupyter/install-jupyter-emr5.sh",Args=[--r,--julia,--toree,--torch,--ruby,--ds-packages,--ml-packages,--python-packages,'ggplot nilearn',--port,8880,--password,jupyter,--jupyterhub,--jupyterhub-port,8001,--cached-install,--notebook-dir,s3://<your-s3-bucket>/notebooks/,--copy-samples]
What I did instead was to follow these instructions for installing anaconda directly in the EMR instance using the CLI. If you follow the first part you should be able to get it up and running. To summarize here:
ssh into your master emr instance using the .pem file you saved
once there's you'll want to install anaconda using super user priveledges: sudo wget http://repo.continuum.io/archive/Anaconda3-4.1.1-Linux-x86_64.sh. Then bash Anaconda3–4.1.1-Linux-x86_64.sh
Make sure you're using the anaconda version of python: which python
If you're not, specify your source: source .bashrc
Now make a jupyter config file: jupyter notebook --generate-config
cd into the jupyter folder: cd ~/.jupyter/
update the config file: vi jupyter_notebook_config.py
In the config file add the following lines:
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 6789 <---pick whichever port you want
exit out of the config editor and run jupyter via: jupyter notebook
this should run a notebook with no active kernels (for now). But it will give you the token you're looking for: http://localhost:6789/?token=xxxxxx
Leave this running, and open a new terminal window. Now you'll want to tunnel to the EMR instance per this aws blog post (make the port the same as the one you specified in the config file). ssh -o ServerAliveInterval=10 -i <<credentials.pem>> -N -L 8192:<<master-public-dns-name>>:8192 hadoop#<<master-public-dns-name>>
Opening localhost:6789 in the browser should prompt you with the jupyter page to enter your password or token. Enter the token that was generated in the above step and you should be good to go.
Hope this helps! There might be a less convoluted way, but this is what ended up working for me.

Change jupyter notebook server password

I would like to change my jupyter notebook server's password to something else. I see on Jupyter's documentation (http://jupyter-notebook.readthedocs.org/en/latest/public_server.html) how to prepare a password for ostensibly a new server but not how to change an existing one.
Can I simply:
Generate a new SHA hash for a password as the documentation above specifies
Replace the password in the PWDFILE environment variable (located in jupyter_notebook_config.py)
Restart the jupyter server
Basically, I'm asking because I don't want to confuse and/or mess up the authentication system by just changing things.
From version 5.0, you can easily change current password with jupyter notebook password command.
Note : I tested it on windows environment.
Start -> Anaconda Powershell Prompt
It will display you the prompt like below:
(base) PS C:\yourName >
Enter below command :
(base) PS C:\yourName > jupyter notebook password
It will ask you for new password
Currently its 2022 and the jupyter notebook password still works
Reposting as an answer:
The process to change the password should be just the same as setting it in the first place. Jupyter hashes the password you enter, and compares it with the hash it loaded from the config file. It doesn't copy the hash to any other persistent storage (though it does store it in memory, so you will need to restart the notebook server).
I'm not sure how environment variables are involved - I don't think the instructions use any for the password.

Could not upload files error in GitFTP

I'm following tutorial on http://anantgarg.com/2013/09/25/git-ftp-for-windows/ and get error:
$ git ftp init
There are 720 files to sync:
[1 of 720] Buffered for upload '.gitignore'.
[2 of 720] Buffered for upload 'wp-config-sample.php'.
....
[24 of 720] Buffered for upload 'wp-content/plugins/woocommerce/admin/post-types/writepanels/order-item-html.php'.
Uploading ...
fatal: Could not upload files., exiting...
what could be the problem? I've set the password using quotes ( 'mypassword' ) but same error still occur
You can see output of the exact error by using the '-v' flag for super-verbose output.
The problem could be one of the following
Incorrect FTP credentials - check that the server, username, and password are all correct.
URL/server: make sure to include the protocol with the URL if not standard FTP
(sftp://ftp.domain.com:22).
Password: Try also removing the quotes around the password
The server path is not set or incorrect. Often, an FTP login takes you to the server root. You may not have write-privileges there. You'll need to set the site root path.
try setting path with in the URL argument ftp://ftp.domain.com/public_html
Try doing an 'init' via command-line arguments instead (NOT via Git config settings) and set verbose output using '-v':
git ftp init -u username -p 'password' -v ftpserverurl.com
I think you should use ftp-git, it's a GUI tool to push changed files in git repository to ftp server. And it's more error-friendly.
You can check the changed files in GUI way, and it can save your ftp connection details for future use.

How to write on terminal after login with telnet to remote machine using python

I am trying to connect a remote machine in python. I used telnetlib module and could connect to machine after entering login id and password as
tn = Telnet("HOST IP")
tn.write("UID")
tn.write("PWD")
After entering password, the terminal connects to the remote machine which is a linux based software [having its own IP address(HOST IP).]
Then after If I try to give a command e.g. tn.write("cd //tmp/media/..) to go to its various folders then it does not work and when checked to see what the screen is showing with
tn.read_very_eager()
error comes up as :
""\r\n\r\n\r\nBusyBox v1.19.4 (2012-07-19 22:27:43 CEST) built-in shell (ash)\r\n
Enter 'help' for a list of built-in commands.\r\n\r\n~ # ""
I wanted to know if there is any method in Python as we have in PERL as $telnet->cmd ("cd //tmp/media/..)
Any suggestions are welcomed if you can give an example!!!
You should try to login to the machine using telnet, then you will notice you will login into BusyBox. That string you print not an error it is hte normal BusyBox prompt.
It might not be what you expected, I only know BusyBox from Linux boxes that were unable to properly boot.