PYNQ: PYTHON PRODUCTIVITY

Jupyter notebooks permissions

Hi folks,

The jupyter_notebooks directory on the target is owned by root, and creating folders from the browser sets ownership for root as well, whereas accessing over samba or SSH using the xilinx user get permissions to this user. This dichotomy creates a few issues, particularly to users not familiar with permissions. For example, doing SSH-copy (scp) as xilinx user on a directory created from the browser.
So my question is, is there a good reason Jupyter files are owned by root? I assume this is because the server process runs as root as well. Could this be changed to the xilinx user at build time?

Thanks,
-Pat

That’s exactly the reason.
The fact that jupyter runs as root will inevitably cause folders created within this context to be root-owned.

However, what you describe at the beginning (regarding the jupyter_notebook dir) should not happen. If you look at this https://github.com/Xilinx/PYNQ/blob/master/sdbuild/packages/pynq/qemu.sh
(bottom) you will see that permissions are set to xilinx:xilinx

That of course is not the case for user-created folders while using jupyter, since the process owner for the server, as you mention, is root.

My best advice is that you set the permissions yourself opening a terminal in Jupyter (right click on “New” at top right and then “Terminal”) with chown xilinx:xilinx your-folder. I know this is a workaround, but this “dichotomy” as you describe it is currently sort of a limitation that we don’t really have plans to address at the moment.

Another (possible) solution might be that you SSH as root (password is xilinx as well for root). To enable it you’ll have to uncomment the “#PermitRootLogin” line of /etc/ssh/sshd_config and set it to yes

vim /etc/ssh/sshd_config

uncomment “#PermitRootLogin …”

PermitRootLogin yes

save the file and restart ssh service (or the board)

/etc/init.d/ssh restart

That should do.

1 Like