SAMBA File server and Moodle?

SAMBA File server and Moodle?

by pinguim oitenta e seis -
Number of replies: 6

Hi,

How can I use a Samba file server with moodle?

How can I use samba as private files and public files with moodle?

My Samba file server is a different server of moodle server.

How can I integrate both?

Thanks

Average of ratings: -
In reply to pinguim oitenta e seis

Re: SAMBA File server and Moodle?

by Ken Task -
Picture of Particularly helpful Moodlers

Samba runs on Linux to be able to see Windows shares, etc.   So your Samba server is really Linux ... right?

While Samba was a marvel in its day, there has been new offerings ... like NextCloud or OwnCloud.

However, should you want to pursue, there was/is a plugin (last time I used it was for version 1.9 of Moodle served from a Linux server) ... but don't know if compat with higher versions of Moodle ...

https://moodle.org/plugins/block_smb_web_client

Also see:

https://docs.moodle.org/311/en/ownCloud_Repository

'SoS', Ken


In reply to Ken Task

Re: SAMBA File server and Moodle?

by pinguim oitenta e seis -
Hi Ken,

I am using samba under a linux. The Idea is the file server to serve windows shares too.

The samba client for moodle It is depreciated. I see there is a repository for filesystems on the configuration section. The folders needs to bee inside the /moodledata directory to work.

I need to make an remote repository for the samba's server filesystem. How can I do it? As samba client is no loonger at the moodle's newers version, Is there a way to connect the repository via remote filesystem for the samba server?

Thanks.
In reply to pinguim oitenta e seis

Re: SAMBA File server and Moodle?

by Ken Task -
Picture of Particularly helpful Moodlers

Kinda surprised this thread still open ... not for date/age, but topic!

But ...

Here's an old 'announcement' about smb no longer part of core:

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

In above poster shows how to mount a samba file share in linux.

More than likely you'd have to install supports for cifs using that.

If you get that to work, there could be a symlink from moodledata/repository/ to that mount point created but am not at all sure how users access would be controlled.

Might be a one direction thing ... copy from but not upload to - and linking from moodle to a file in samba I would think to be a problem.

There might be better resource persons ... other than myself ... @https://tracker.moodle.org/browse/CONTRIB-1103

Best of luck!

'SoS', Ken


In reply to Ken Task

Re: SAMBA File server and Moodle?

by Ken Task -
Picture of Particularly helpful Moodlers

Follow up to own post ... a 'catch 22' IF ... IF ... you do make a symlink for that mount point for Samba ... and IF ... IF ... you use tar to backup moodledata ...

If backing up via Apache and server set to follow symlinks = massive backup.

Consider making a minimal tar ball of moodledata/filedir/ and NOT including the repository/samba 

Also, have you explored other options ... like an Amazon Bucket or Google Bucket or other?  I have a Google Bucket - 1P - that's P for Pentabyte - that I've mounted on multiple Linux servers and have a symlink in moodledata/repository/   Use it for site backups as well as course backups from other Moodles.  All Moodles can see that repo.   Comes in handy when migrating anything! ;)

'SoS', Ken

In reply to Ken Task

Re: SAMBA File server and Moodle?

by pinguim oitenta e seis -
Hi Ken,

Can you correct me if I am wrong?

At moodledata/repo should I create a remote link for samba 192.168.0.2 samba server? So at the moodle server 192.168.0.3 at /moodledata/repodir I need to map the folder for 192.168.0.2 sambahome-dir/samba-dir-shared?

Thanks.
In reply to pinguim oitenta e seis

Re: SAMBA File server and Moodle?

by Ken Task -
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