Create a network share between 2 Linux VM's

Good morning everyone.

I am new to the forum and fairly new to Linux ubuntu 18.04.

We are running bare metal clustered servers running on HyperV 2016.

On that cluster, I have 2 Linux instances running on Ubuntu 18.04, Sadly our requirements have changed and we need to deploy more of these instances that will be focussing on a single microservice.

My problem is the following - These service needs access to a central folder for them to do certain calculations.

What I have done already -
Linux box (S1) - installed samba and samba configurator to set up the shared drive and created a new user. Added Chmod 0777 to the shared drive.

Linux box (S1.1) - Connected to the shared folder using the new username and password, but I do not have any permissions I cannot read, write anything and then the network browser hangs

This behavior is experienced as a windows client to S1 and as a Linux ubuntu client to S1

I am afraid that this might be a very simple solution, but I have googled for the past 4 days and none of the solutions work

Welcome to the forum.

I was on my way off for the evening but saw this. I’ll drop a few pointers, but I’m going to have to head off after that.

So. First thing’s first: if you’re using all Linux machines, I recommend using NFS over Samba. It’s a faster and more Linux-friendly protocol.

Secondly, when you mount shares in Linux, you have to take into consideration the mount permissions. the mount command can take an options flag -o. You can then provide it a uid and gid flag in there which will tell it to mount it and set the ownership of that mount to a specific user.

To chain that together with a SMB (or cifs) share, it would look like this:

mount -t cifs -o uid=1000,gid=1000 //192.168.1.5/sharename /path/to/mount/point

If you’re doing this in /etc/fstab, you can do the following:

//192.168.1.5/sharename cifs /path/to/mount/point uid=1000,gid=1000,_netdev 0 0

_netdev tells the OS that this is a network mount and to wait for the network to come up before trying to mount it.

You need to figure out what the numerical value of the user and group you want to own the share are. You can do that with id <username>.

Now, I don’t exactly have time to give you a complete NFS tutorial, but this should get you up and running with Samba.

If you’d like to learn more about NFS, DigitalOcean has a great guide here:

5 Likes

Thank you very much. I will test this as soon as possible and revert.

Really appreciate your time.

1 Like

Happy to help.

I think that option is more for telling it it’s a network thing so it won’t wait for it and cause booting to hang/fail

1 Like

Good day everyone.

Thank you all for your assistance.

I feel a bit stupid but thanks to the link sent I was able to find my issue.

I was running samba and nfs on the same server, I removed samba and reconfigured the exports

file /mnt/sharedfolder clientIP(rw,sync,no_subtree_check)

I was using a subnet/24 and changing the client ip to the actual client’s ip addresses solved my issue

Regards,

3 Likes

Thanks for following up, glad you were able to get everything sorted out!