I set up Samba, it shared /tmp!

Bottom line: Samba appears to share the /tmp directory when set up according to the documentaiton. I think this is a bad thing.

I am running OpenWrt 18.06.1 r7258-5eb055306f / LuCI openwrt-18.06 branch (git-18.228.31946-f64b152) on Linksys WRT1900ACv2.

I followed the instructions on https://openwrt.org/docs/guide-user/storage/usb-drives and added a USB drive that has some videos.

I set up Samba according to https://openwrt.org/docs/guide-user/services/nas/samba_configuration.

As usual, the experience was awesome. It worked. I went over to my Libreelec/Kodi media server and accessed the Samba shares. I found that I could look at /tmp in my router. That is, I found the shares that I intended plus one more share that was the user's home directory. On Libreelec/Kodi is showed a directory called "sheep", the user name I chose. I realised that the home directory, according to the above link, is /var. To be a bit more clear, the instructions suggest that a user can be created with the home directory of /var. That maps to /tmp or the filesystem tmpfs. I suspect that Samba is sharing not only what is explicitly entered in LuCi or the config files but also that home directory of the user. As a workaround, I changed the /etc/passwd file entry for the Samba user to:

sheep:*:1001:65534:sheep:/mnt/sda1/Video:/bin/false

The documentation says the home directory should be

sheep:*:1001:65534:sheep:/var:/bin/false

(The documentation had the user name to be "newuser", I chose "sheep"). In any case, I want to warn people not to inadvertently share /var, which is /tmp or the tmpfs filesystem when using Samba. With the substitution of the home directory of the user being something that I intended to share there is less risk of someone on the network screwing up /var. After the change, my media server did indeed share /mnt/sda1/Video instead of /var.

I'm a total noobie to posting to forums and such, so please have mercy. I would like to give back, so feel free to suggest to me how I can help by improving documentation if appropriate. Also, I understand that you may wish to see certain configuration files to see how I might have screwed up my implementation. I searched for things like "samba /tmp share" and only found a case where someone actually wanted to share /tmp.

Thanks to those involved in the huge effort in creating such an awesome product!

Regards,
CG

That page does not describe Samba installation.
Which guide did you follow?

You are correct. The guide I followed is https://openwrt.org/docs/guide-user/services/nas/samba_configuration. I've edited the post with the correction as well.

Samba does share home directory by default, there should be a box to enable/disable in Luci>Services>Network Shares>Samba>General Settings -

Screenshot from 2020-01-05 18-54-16

That's the answer. As usual, something really simple and overlooked. I read the following


in https://openwrt.org/docs/guide-user/services/nas/samba_configuration
That led me to believe that using /var was a reasonable thing to do for setting up Samba while it does, in fact, share /var by default. I am going to have a look at how to modify the documentation and try to see if I can't change the wording with respect to the user home account setup in /etc/passwd.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.