phytec / doc-bsp-yocto

Yocto BSP Documentation
https://phytec.github.io/doc-bsp-yocto/
1 stars 1 forks source link

Check tftp file access rights #123

Closed s-hemer closed 10 months ago

s-hemer commented 11 months ago

https://github.com/phytec/doc-bsp-yocto/blob/3a60054e8286c5bf023d1a677910b985f7d76630/source/bsp/imx8/development.rsti#L38-L39

That needs some investigation again! From the tftpd man page (Ubuntu 22.04):

tftpd will allow only publicly readable files (o+r) to be accessed, unless the --permissive option is specified.

and

--user: Specify the username which tftpd will run as; the default is "nobody"

/etc/default/tftpd-hpa specifies

TFTP_USERNAME="tftp"       
TFTP_OPTIONS="--secure --create" 

by default and in the docu (BTW use the long options in docu?!). So, tftpd will run with "tftp" user, not "nobody", but as the --permissive is not set, it will check for o+r. To my understanding, that would mean no need to change owner and only chmod to o+r. Yet, it explains all the docu in the net about change to user nobody etc.

It would be great if someone could test and approve this, so the docu does not look like "we just copied together rumors from the net" but more like "we know what we are doing".

s-hemer commented 10 months ago

Just tested with barebox (2022.02.*) on an imx6ul and tftpd-hpa (default config) on Ubuntu 22.04:

It seems to be sufficient to solely set the access rights to o+r of the copied file in question. No change of owner (may even be root:root, had to copy with sudo as the owner of the folder was still tftp:tftp), no restart of tftpd.