Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Requesting password in IPython notebook

I have an IPython notebook which accesses data via SSH using encrypted ssh key file. I don't want to store the password in the notebook (nor in a separate file). I can use input in order to read the password from user prompt, but in this case the password is visible on the screen. Is there a way to securely obtaining password?

like image 809
Boris Gorelik Avatar asked Jun 25 '14 14:06

Boris Gorelik


People also ask

How do you put a password on a jupyter notebook?

Resetting your PasswordOpen your Jupyter environment. Then run "jupyter notebook password". Enter a new password when prompted.

Why does Jupyter ask for password?

If you enable a password for your notebook server, token authentication is not enabled by default, and the behavior of the notebook server is unchanged from versions earlier than 4.3. When token authentication is enabled, the notebook uses a token to authenticate requests.

How do I give access to my jupyter notebook?

You can set access control for Jupyter notebooks at the account level and at the object level. This feature is available in the latest version of Jupyter Notebooks. If you are not using the latest version of Jupyter notebooks, you can enable this feature from the Control Panel >> Account Features page.


1 Answers

You should import the getpass module, then call getpass.getpass.

import getpass
password = getpass.getpass()

Note that in old versions, the field where you enter the password may not appear in the IPython Notebook, but instead in your terminal/command prompt window. In the latest versions of Jupyter Notebook, however, the prompt will appear in the Notebook itself.

like image 76
DataSwede Avatar answered Oct 17 '22 19:10

DataSwede