Using jupyter notebook version 6.3.0 with python 3.6.9 on an Azure VM running Ubuntu 18.04.
My desktop is running Linux Mint Ulyana (basically ubuntu 20.04)
I am trying to run the jupyter server automatically on every start up of the azure vm, and tunnel the port 8888 of the VM to my local port 8081. I am trying the following script.
#!/usr/bin/env bash # encoding:utf-8 # Start the virtual machine az vm start --resource-group mcg_corp --name ml_dev SERVER=126.96.36.199 # Start the jupyter service # Option 1 # ssh "$USER@$SERVER" bash << EOF # nohup jupyter-notebook --no-browser --port 8888 > /dev/null 2>&1 & # exit # EOF # Option 2 ssh -t "$USER@$SERVER" 'nohup jupyter-notebook --no-browser --port 8888 > /dev/null 2>&1 &' # Tunnel the jupyter service nohup ssh -N -L localhost:8081:localhost:8888 $SERVER & #8081:Local port 8888:remote port # Mount the home directory of the remote locally sshfs -o allow_other $SERVER:$HOME dev
The username $USER is same in local and the remote. The problem is the remote machine is starting jupyter notebook with the root privilege. When I look up the running processes by
ps -ef|grep jupyter, the command I find running is
/usr/bin/python3 /usr/bin/jupyter-notebook --no-browser --port 8888
But if I log in manually with ssh and start jupyter notebook in the server, this is the command running.
/usr/bin/python3 /home/$USER/.local/bin/jupyter-notebook --no-browser
So how to make sure that jupyter notebook starts with my user privilege in my home directory in the remote? If that happens, then I believe I can get the rest of the flow working correctly.
I am in the sudoer list in the remote as well, but I do not want to run jupyter from root.