# How to mount webserver directory on a Raspberry pi 4

#### zazas321

Joined Nov 29, 2015
917
Hello. I have a virtual ubuntu server where I have created my file manager server:
https://github.com/efeiefei/node-file-manager

This is required for me in order to easily monitor/change various files that other people upload. Various configuration files will be uploaded here by other people and I must have an easy access to these files from python script.

I can reach the file manager from the web browser 192.168.3.170:8080 but Ideally I want to mount the webserver directory on some folder on my Raspberry pi 4 device. For example I want to create a folder named "remote_files" and in there I would directly see what files are uploaded to the webserver and I can read them, delete them and write to them.

I know you can mount NAS drive (spiffs) as I have done it myself previously, but I cannot really figure out how can I mount the directory from the webserver. Please help! Thanks in advance

#### Yaakov

Joined Jan 27, 2019
3,603
If you can make the httpd provide a WebDAV share, you can use something like davfs2 to mount it as a filesystem on the remote machine.

#### Yaakov

Joined Jan 27, 2019
3,603
I'll add this, though the last time I tried to use FUSE to mount an http directory it was slow and unreliable, this is newer and may be worth a try if WebDAV is too hard for you:

https://github.com/fangfufu/httpdirfs

#### MrSalts

Joined Apr 2, 2020
654
@zazas321
The best way to serve files from a Linux box to a Windows + Linux network w/Graphical file system is SAMBA. Secure, well documented and widely used. Works on a pi. You can even connect the "files" app on your iPhone/iPad and edit files with office360 apps or image editing apps. Super easy, looks like an extra disk once mounted. Remember your password as you set it up.

Last edited:

#### zazas321

Joined Nov 29, 2015
917
Hey. Thanks for the responses and sorry for the late reply. I have been experimenting with the samba a bit. I have created a samba share on my ubuntu server. I have followed these steps:

Install samba

Code:
sudo apt-get install samba
Make a directory for sharing:
Code:
sudo mkdir /srv/samba/share
edit smb.conf file and add the following:
Code:
sudo nano /etc/samba/smb.conf
Code:
[PTL_share]
comment = PTL samba file server share
path = /srv/samba/share
browsable = yes
guest = ok
read only = no
I have then created a samba user and password:
Code:
sudo smbpasswd-a lukas.petrikas

I then restarted the smbd service:
Code:
sudo service smbd restart
And then allowed the samba through the firewall on my server:
Code:
sudo ufw allow samba
I then went to my other linux machine and tried the following command:
Code:
smbclient -L 192.168.3.146
And the result is:
Code:
pi@raspberrypi:~ $smbclient -L 192.168.3.146 mkdir failed on directory /var/run/samba/msg.lock: Permission denied Unable to initialize messaging context Enter WORKGROUP\pi's password: Sharename Type Comment --------- ---- ------- print$          Disk      Printer Drivers
PTL_share       Disk      PTL samba file server share
IPC\$            IPC       IPC Service (ems-picktolight server (Samba, Ubuntu))
Reconnecting with SMB1 for workgroup listing.
smbXcli_negprot_smb1_done: No compatible protocol selected by server.
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE
Failed to connect with SMB1 -- no workgroup available
I can see the sharename displayed (PTL_share) but I get disconnect due to incompatible protocol. How can this be solved?
Also, when creating a user and password using smbpasswd command, does it must match the name of the user that is connecting? in my case I am connecting from user pi

#### zazas321

Joined Nov 29, 2015
917
UPDATE

I am able to mount my share with the following command on my other machine:
Code:
sudo mount -t cifs //192.168.3.146/PTL_share -o username=lukas.petrikas, password=***** /home/pi/PTL/PTL_share
And that seems to work fine, I can see the files in there but not able to write anything due to permissions issue.

Please can someone explain what is the difference between mounting the share using smbclient commands and mounting it directly using sudo mount -t cifs

#### MrSalts

Joined Apr 2, 2020
654
samba permissions raspberry pi

then under tools on the search results page , select "past year"

there are several updates of samba over the years and using old instructions is not a good idea.
You likely have an ownership issue. If you created the share file with root on the server box, then the client would not be root so you cannot share. Do the search and see what comes up (I got lots of results but no time to go though everything.

#### zazas321

Joined Nov 29, 2015
917
Perhaps the best would be to use the new file share standard NFS. However, I was still not able to solve the issue where I cannot modify/write any files from my client machine. I do not need write permissions really so that is not an issue for me, I can read files without any issues so that is okay, perhaps even better as other people are going to work on this system and I do not want them to delete anyhing by mistake

#### MrSalts

Joined Apr 2, 2020
654
new file share standard NFS
If nobody is using windiows, then yes, NFS would work for you (NFS can work with Windows but not always easy). "New" is a relative term but NFS has been around since the mid-1980s.

Finally, if any machine in your network is dual-boot (Windows/Linux), it may be locking up the write capability if that(those) computer(s) are put in sleep mode in one OS and launched in the second operating system.