SAMBA File server and Moodle?

Re: SAMBA File server and Moodle?

by Ken Task -
Number of replies: 0
Picture of Particularly helpful Moodlers

See:

https://moodle.org/mod/forum/discuss.php?d=118704

In above forum, poster shows how to mount a samba file share in linux - #2 below.

Clips from above forum posting:

1. Enable file system plugin and set up your local repository, say:
/home/dongsheng/smaba_dir

2. mount samba host
mount -t cifs -o username=xxx,password=xxx //samba_host/samba_dir /home/dongsheng/samba_dir


Do number 2 before trying number 1 above.

cifs is a file system ... do you have that installed on your linux server?

https://linuxize.com/post/how-to-mount-cifs-windows-share-on-linux/

So you've turned on file system repository in Moodle.

In #2 above, the mount point is called "/home/dongsheng/samba_dir"  That's how the mount point will show in Linux.   On your system that could be just about anywhere!! and called just about whatever you like ... small case letters ... whatever makes sense to you.

/home probably because /home is typically the largest partition on a server that was setup for multiple users.

The 'dongsheng' was posters first name ... but see the mount command ... username=

Am guessing the /samba_dir named thusly as to help admin person, ie, you, to recognize it's purpose ... 'samba'.

Now in Moodle, from command line:
cd /path/to/moodledata/
mkdir repository
chown apache:apache repository -R (if on ubuntu/debian: www-data:www-data)
chmod ugo+rwx repository -R
Now for the symlink to the mount called /home/dongsheng/samba_dir
cd repository
ln -fs /home/dongsheng/samba_dir samba

When you ls -l the repository directory now, one should see something like:

lrwxrwxrwx. 1 www-data www-data ## Mon Day  2021 samba -> /home/dongsheng/samba_dir

'samba' above typically in a color

Now the test from command line:
cd samba
nano testtextfile.txt

In testtextfile.txt, just one line ... 'hope this works!'.
Save the testtextfile.txt and exit nano.

Since you created that file as root, chown apache:apache *.txt
and chmod ugo+rwx *.txt

Now do number 1 above ... in moodle.

Once you have done that, go into a course and check to see if you can see that file system repo.

Probably the most useful command one can learn in linux is: man (if you have the online manual installed);

As root user, type: man mount [ENTER]

Also: man ln (that's a lower case 'L' followed by an 'n' ... ln - make links between files/folders

That should show you everything you didn't want to know about the both commands.

And a reminder:   I don't know that will work for ya.  If you can see files in the repo, tinker and play a lot to see what works and what doesn't!

'SoS', Ken