title: Jupyter notebook SSH Tunneling error "The signatures database cannot be opened"
body: <p>My university has a Linux machine with a powerful Jupyter running on campus. Here are the steps I use to log in to the remote server through my Windows laptop and run Jupyter notebook on server, that can be edited on my local browser through ssh tunnelling, but it always gives me the same error:</p>
  
  <ol>
  <li>Install anaconda and Jupyter on remote server</li>
  <li>Create my environment and activate it</li>
  <li><p>For SSH tunneling, here's how I connect to the remote server on CMD:</p>
  
  <pre><code>Ssh –L 8000(on my laptop):localhost:8889(on remote server) &lt;MyUserID&gt;@&lt;RemoteServerIP&gt;
  </code></pre></li>
  <li><p>After this it asks for my password and I enter the remote server</p></li>
  <li><p>To activate anaconda, I use the following command:</p>
  
  <pre><code>source $HOME/anaconda3/bin/activate 
  </code></pre></li>
  <li><p>After entering anaconda, I activate my environment: </p>
  
  <pre><code>conda activate &lt;env_name&gt;
  </code></pre></li>
  <li><p>After entering the environment, to start jupyter notebook, I type:</p>
  
  <pre><code>jupyter notebook
  </code></pre>
  
  <p>or</p>
  
  <pre><code>jupyter notebook --no-browser --port=8889 
  </code></pre></li>
  <li><p>Then it displays:</p>
  
  <pre><code>[I 09:04:06.122 NotebookApp] Writing notebook server cookie secret to /run/user/148037468/jupyter/notebook_cookie_secret
  [I 09:04:06.881 NotebookApp] Serving notebooks from local directory: &lt;directoryname&gt;
  [I 09:04:06.881 NotebookApp] The Jupyter Notebook is running at:
  [I 09:04:06.881 NotebookApp] http://localhost:8889/
  [I 09:04:06.881 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
  [I 09:05:10.507 NotebookApp] 302 GET / (::1) 1.43ms
  </code></pre></li>
  <li><p>Then on my laptop, I type:</p>
  
  <pre><code>localhost:8000
  </code></pre>
  
  <p>It redirects me to the login page where I successfully see my directory in jupyter notebook and I click on a .ipynb file</p></li>
  <li><p>After this step it never loads the notebook and displays the following error on the notebook:</p>
  
  <blockquote>
    <p>A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.</p>
  </blockquote></li>
  </ol>
  
  <p>It gives the following error on the terminal:</p>
  
  <pre><code>The signatures database cannot be opened; maybe it is corrupted or encrypted. You may need to rerun your notebooks to ensure that they are trusted to run Javascript. The old signatures database has been renamed to &lt;directory_name&gt;.local/share/jupyter/nbsignatures.db.bak and a new one has been created.
  [W 09:17:35.807 NotebookApp] Failed commiting signatures database to disk. 
  You may need to move the database file to a non-networked file system, using config option `NotebookNotary.db_file`. Using in-memory signatures database for the remainder of this session.
  [W 09:17:35.811 NotebookApp] Notebook plots1.ipynb is not trusted
  [W 09:17:35.881 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20190319090406 (::1) 17.39ms referer=http://localhost:8000/notebooks/plots1.ipynb
  [I 09:17:36.430 NotebookApp] Kernel started: 242b529a-5acd-4b5f-8a6d-356947ab30d2
  [W 09:18:36.467 NotebookApp] Timeout waiting for kernel_info reply from 242b529a-5acd-4b5f-8a6d-356947ab30d2
  /&lt;directory_name&gt;/anaconda3/envs/braingrid/lib/python3.6/site-packages/notebook/base/zmqhandlers.py:284: RuntimeWarning: coroutine 'WebSocketHandler.get' was never awaited
  super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs)
  [W 09:18:38.276 NotebookApp] Replacing stale connection: 242b529a-5acd-4b5f-8a6d-356947ab30d2:dd09ca5465ba404a886c71b3ca787d6b
  [W 09:21:36.370 NotebookApp] Notebook plots1.ipynb is not trusted
  
  [IPKernelApp] ERROR | Failed to open SQLite history /&lt;directory_name&gt;/.ipython/profile_default/history.sqlite (database is locked).
  [IPKernelApp] ERROR | History file was moved to /&lt;directory_name&gt;/.ipython/profile_default/history-corrupt.sqlite and a new file created.
  </code></pre>
  
  <p>And the Jupyter notebook keeps displaying: </p>
  
  <pre><code>"Connecting to terminal"
  </code></pre>
  
  <p>I don't know how to fix this. I am new to Linux. None of the sudo commands work as I am not the admin/ or have those privileges</p>
  
  <p>This setup is necessary for my thesis.</p>