Jump to content

Recommended Posts

Posted

im trying to get Windows Share Web Client to work, i have samba working on the server and i can access any folder or file i want to, but i cant get Windows Share Web Client to diplay the items.

 

i think its something to do with

 

$smb_cfg->cfgWinShareToSmb=array();

 

i cant figure out what i need to put in there

 

the current server is for windows \\server-dc\username

and when i use samba i use //server-dc/username

 

should i set

 

$smb_cfg->cfgWinShareToSmb=array(

'\\server-dc'=>'//server-dc'

);

 

or something else?

 

should i use Domain or our FQDN?

 

thanks

Posted
i can, im using cygwin to link to my IIS6 web server, im not sure what i should set as the samba server name, should it be the same as the normal network name?
Posted

i have, i can get the smbclient to work fine, i can ping the server that has the file on the ip/name and FQDN, i just cant get the plugin to connect to the server i need,

 

i think this is what is confusing me "mydom/myserver"

 

would that be "domain/server-dc" or "FQDN/server-dc"? or even something else, at the moment its just showing me the top menus with no content listed

Posted

I have

 

'\\Servername' => 'domain.local/servername',

 

If you have this and your content is still empty, then I would check permissions on the test home drive.

Posted
i have tried that, our FQDN and just domain, and its all the same, cant get any content to come up, what should the permissions be, allow the user to see? they have full control of the folder at the moment.
Posted

My recommendation for testing and testing only, we gave our test user full control of the home folder and any folder that it was contained in, for example students. The user has to have permissions to transverse the folders.

 

Are you users home drives set in AD via a server name or a domain.local DFS share?

Posted (edited)

Before any of it will work, you need to have the smbclient binary installed on the webserver - see http://www.citricity.com/moodlegpl/windowssharewebclient/instructions_for_installing_smbclient32_on_windows.pdf

Once it's installed, test it with the following command line:

 

smbclient -L servername -U DOMAIN/username

 

Where servername is the netbios name (just the server name, not it's FQDN). You should be promtped for your password, and it should then list all shares/resources available to you on that server. Once you've proven that to be working, you can move on to sorting the block out.

 

First part of the config file sets up who the servers are and how to refer to them:

 

$smb_cfg->cfgWinShareToSmb=array(
   '\\server01'=>'DOMAIN/server01',
   '\\server02'=>'DOMAIN/server02'
);

 

The next section sets up the shares...

 

$smb_cfg->cfgWinShares=array(
   'share1'=>array(
       'share'=>'DOMAIN/server01/Share1',
       'title'=>'Staff Resources',
       'courses'=>array(1)
   ),
   'share2'=>array(
       'share'=>'DOMAIN/server01/Share2',
       'title'=>'Shared Documents',
       'courses'=>array(1)
   )
   ,
   'share3'=>array(
       'share'=>'DOMAIN/server2/share1',
       'title'=>'ITTeam',
       'courses'=>array(53)
   )
,
   'share4'=>array(
       'share'=>'DOMAIN/server02/share2',
       'title'=>'Admin Data',
       'courses'=>array(56)
   )
);

 

...where shareX is the shared folder name as displayed when browsing to that server via start > run > \\servername

The 'courses' field is the Moodle course to which that share is associated. Those enrolled to that course then automatically have that share displayed in the block. Permissions are derived from username and password, which should be your user's AD username and password, which should be acquired using the LDAPCapture plugin for Moodle.

Edited by Marci
Posted

ive gone through the setup, SMBCLIENT works and i can connect to any share i want using the apropriate username and password, ive tried setting up the config as above but i dont get any files shown in the block.

 

Is DOMAIN listerally Domain?

 

can i test the block without LDAPCapture and then intergrate it when its working?

 

thanks

Posted

Where in our case FQDN is Horbury.Internal, the DOMAIN used in the config file is just 'HORBURY' (ie: the one-word netbios name).

 

I've NEVER managed to get any output from the block without LDAPCapture, as the password isn't correctly encrypted to present to AD. If you're seeing blankness, it's usually because as far as the block is concerned you don't have permission to see the contents of the share in question, which is usually due to not getting the password across succesfully. This is the purpose of LDAPCapture. Grab it from Moodle.org: open-source community-based tools for learning, and set it as your default auth plugin.

Posted

No it has to be done with LDAP Capture im afraid, I believe it is LDAPCapture that gets the home drive details etc.

 

The domain is literally just that, say I worked at Town High School and my domain was ths.local and my server was called Bob then in my config file I would have

 

'\\Bob'=>'ths.local/Bob'

 

May I suggest something else, try creating a new account totally, as in within Active Directory and setup the home drive etc. Then login to Moodle (for the first time) using this account, you will have to do the standard account details if it requests you to. Then try the block.

 

The reason I say try a new account is because I have had problems with an account that was created (not through syncing) by logging in when I only had LDAPServer on, I got a blank folder.

Posted
thanks, ive stuck our netbios name in the place of domain, going to change over to LDAP Capture later, does the cronjob need to be modified to get it working? i use the auth_ldap_sync_users.php to transfer new users over overnight.
Posted

Yes you will need to change your cronjob.

 

Here is a copy of mine, The change needed is minimal though:

 

sudo /usr/bin/php -c /etc/php5/apache2/php.ini -d memory_limit=512M /var/www/moodle/auth/ldapcapture/auth_ldapcapture_sync_users.php

 

Obviously your location of your moodle install and auth block may also be different.

Posted
LDAPCapture just passes thru and auths against AD, and upon succesful auth writes users into the database. You should be able to use auth_ldap_sync_users.php to keep their details in check, but the password is never written to the database.
Posted

does this look right

 

if (isset($_SERVER['REMOTE_ADDR'])) {
   error_log("should not be called from web server!");
   exit;
}
$nomoodlecookie = true; // cookie not needed
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/mod/resource/lib.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
if (!is_enabled_auth('ldapcapture')) {
   echo "Plugin not enabled!";
   die;
}
$ldapauth = get_auth_plugin('ldapcapture');
$ldapauth->sync_users(1000, true);
?>

Posted
sudo /usr/bin/php -c /etc/php5/apache2/php.ini -d memory_limit=512M /var/www/moodle/auth/ldapcapture/auth_ldapcapture_sync_users.php

Hmmm... that file doesn't exist fella. You should just be able to use the regular auth_ldap_sync script as per usual without changing anything. The sync still occurs by regular LDAP auth plugin. LDAPCapture is only required for live on-site functionality to passthru the password - no need to write a separate sync script for it that I'm aware of.

Posted

I don't actually have my auto sync daily because I didnt see the need. Its done once a month.

 

The file either existed a good while back or I have created it myself from the one in the LDAPserver auth plugin. Its been well over a year since I set it up to work. That is the script I use to do a manual sync to.

Posted

im now using LDAPCapure plugin and im still just getting the menu up the top and nothing showing as to the contents of the home folder, my drives from the server arnt working either, its not asking for my username and password any more though :)

 

so i have to set the domain/ bit in the config off now?

Posted (edited)

You followed all the instructions in the documentation folder?

 

Also, in the smbclient config file, set

$smb_cfg->cfgSkipNoPwdParam = true;

at the end of the file (regardless of whether you're on uBuntu or not) and regardless of whether you're using ldapcapture or not, your servers should still be specified as DOMAIN/server in the config file.

 

Copy and paste your entire config_smb_web_client.php into a PM and fire it over to me...

Edited by Marci
Posted (edited)

i have, i cant think of anything else i can do, smbclient is set up and i can use it to connect to the shares, LDAPCapture is set up and allows logins.

 

is to big for me to PM

 

here is the config

 

our FQDN is llangefni.anglesey.sch.uk

the netbios version is llangefni

and the servers the files are all stored on at the moment is llangefni-dc

 

$smb_cfg=new stdClass;
$smb_cfg->cfgWebserverType='windows'; // linux or windows - os on your webserver, not your file server!
###################################################################
# String to prefix username - this is useful if you have your
# shares on a different server to your domain controller and your
# usernames need to be passed as domain/username
# $smb_cfg->cfgUserPrefix='domain/'; // try this commented out first!
$smb_cfg->cfgUserPrefix='domain/'; // try this commented out first!

###################################################################
# Array of windows share strings to convert to smb strings
# Windows share is the key and value is the corresponding smb format
# i.e. '\\myserver' => 'mydom/myserver' would replace '\\myserver'
# in a share string with mydom/myserver
$smb_cfg->cfgWinShareToSmb=array(
'\\llangefni-dc'=>'llangefni/llangefni-dc'
);

// new code block for shares - JWI
###################################################################
# Arrays of shares ( other than home directory ) and the courses 
# they can be shown in.  This is to allow administrators to put 
# access to certain shares in certain courses only
# e.g.
# 
#$smb_cfg->cfgWinShares=array(
#    'share1'=>array(
#        'share'=>'admindomain/server1/staff', // windows share
#        'title'=>'Staff Shared Area', // title of share in block
#        'courses'=>array(5) // applicable courses (ids)
#    ),
#    'share2'=>array(
#        'share'=>'studentdomain/srv1/studentshared', // windows share
#        'title'=>'Student Public Area', // title of share in block
#        'courses'=>array(1, 5) // applicable courses (ids)
#    )    
[url="http://www.edugeek.net/misc.php?do=dbtech_usertag_hash&hash=%29"]#)[/url]
#
# NOTE: The convention for specifying your share is domain/server/share - NO LEADING OR TRAILING SLASHES!
# NOTE: Your share key must be unique (e.g. in the example above your next share key should be share3, etc..)
// populate this as in example above
$smb_cfg->cfgWinShares=array(
   'share1'=>array(
       'share'=>'llangefni/llangefni-dc/Staff Drive', // windows share
       'title'=>'Staff Shared Area' // title of share in block
   ),
'share2'=>array(
       'share'=>'GUY-Q430/10.0.0.50/Documents', // windows share
       'title'=>'Documents' // title of share in block
   ) 
);
// if set to true then display all shares on site page providing user has access to any course specific shares
$smb_cfg->cfgAllSharesSite=true;

// end new code block for shares - JWI
###################################################################
# Anonymoys login is disallowed by default.
# If you have public shares in your network (ie you want absolutely everyone (the whole world) to access it) then turn on this flag
# i.e. $smb_cfg->cfgAnonymous = true;
$smb_cfg->cfgAnonymous = false;
###################################################################
# GT MOD 2008-06-19
# Force all files to download instead of trying to open in browser, etc.
# NOTE: This variable used to be $smb_cfg->forceDownloads
$smb_cfg->cfgForceDownloads = true;
###################################################################
# GT MOD 2009-08-03
# Maximum zip size in MBs for downloading folders as zips
$smb_cfg->cfgMaxFolderZipSizeMB=0; // set this to 0 for no size limit!
###################################################################
# Path at web server to store downloaded files. This script will
# check when it need to update the cached file. This path must be
# writable to the user that runs your web server.
# If you set this value to '' cache will be disabled.
# Note: this feature is a security risk.
$smb_cfg->cfgCachePath = false;

###################################################################
# This script try to set language from web browser. If browser
# language is not supported you can set a default language.
$smb_cfg->cfgDefaultLanguage = 'en';

###################################################################
# Default charset (as suggested by Norbert Malecki)
$smb_cfg->cfgDefaultCharset = 'ISO-8859-1';

###################################################################
# Default browse server for your network. A browse server is where
# you run smbclient -L subcommand to read available domains and/or
# workgroups. Set to 'localhost' if you are running SAMBA server
# in your web server. Maybe you will need cfgDefaultUser and
# cfgDefaultPassword if no anonymous browsing is allowed.
$smb_cfg->cfgDefaultServer = 'localhost';

###################################################################
# Path to smbclient program.
# i.e. $smb_cfg->cfgSmbClient = '/usr/bin/smbclient';
// windows servers - set as below
$smb_cfg->cfgSmbClient = 'C:\cygwin\bin\smbclient';
// linux servers - set as below
// $smb_cfg->cfgSmbClient = 'smbclient';

###################################################################
# Authentication method with smbclient
# 'SMB_AUTH_ENV' USER environment variable (more secure)
# 'SMB_AUTH_ARG' smbclient -U param
# 'SMB_AUTH_ARG_WIN' - as above but for running on a windows web server server (not file server!)
$smb_cfg->cfgAuthMode = 'SMB_AUTH_ARG_WIN';

###################################################################
# If you have Apache mod_rewrite installed you can put this
# .htaccess file in same path of smbwebclient.php:
#
#  
#   RewriteEngine on
#   RewriteCond    %{REQUEST_FILENAME}  -d
#   RewriteRule ^(.*/[^\./]*[^/])$ $1/
#   RewriteRule ^(.*)$ smbwebclient.php?path=$1 [QSA,L]
#  
#
# Then you will be able to access to use "pretty" URLs
# i.e: [url]http://server/windows-network/DOMAIN/SERVER/SHARE/PATH[/url]
#
# To do this, all you have to set is cfgBaseUrl (*GT Mod- BaseUrl is set automatically by class_smbwebclient_moodle.php) and set
# cfgModRewrite = true
# (i.e. [url]http://server/windows-network/[/url])
#
# Note - Change this if you want to use mod_rewrite
$smb_cfg->cfgModRewrite = false;

###################################################################
# Do not show dot files (like .cshrc)
#
$smb_cfg->cfgHideDotFiles = true;

###################################################################
# Do not show system shared resources (like admin$ or C$)
#
$smb_cfg->cfgHideSystemShares = true;

###################################################################
# Do not show printer resources
#
$smb_cfg->cfgHidePrinterShares = true;

###################################################################
# Log level
# -1 = no messages
#  0 = log actions performed
#  1 = smbclient calls
# >1 = smbclient output
#
$smb_cfg->cfgLogLevel = 2;

###################################################################
# Log facility (User authentication: BasicAuth or FormAuth)
#
$smb_cfg->cfgFacility = LOG_DAEMON;

###################################################################
# User authentication (BasicAuth or FormAuth)
#
$smb_cfg->cfgUserAuth = 'FormAuth';

###################################################################
# Change PHP session name ('' to use default session name)
#
$smb_cfg->cfgSessionName = 'SMBWebClientID';

###################################################################
# Virus scanner to upload files -- suggested by Bill R <[email="[email protected]"][email protected][/email]>
# Only ClamAV is available in this revision, set to false to
# disable virus scanning.
#
# $smb_cfg->cfgAntivirus = 'ClamAV';
$smb_cfg->cfgAntivirus = false;

###################################################################
# Format to upload compressed folders: tar, tgz or zip 
#
# $smb_cfg->cfgArchiver = 'tgz';
$smb_cfg->cfgArchiver = 'zip';
###################################################################
# INTERFACE CLASS
###################################################################
# inline files (included using base64_encode PHP function)
$smb_cfg->cfgInlineFiles = false;
###################################################################
# Enable specific field to be used to retreive home directory
# Default = homeDirectory (standard for AD)
$smb_cfg->cfgHomeDirField = '';
###################################################################
# IE users have a problem when selecting 'open' for office files
# It basically will open the file in 'temporary internet files'
# and the user will possibly then save the file to this folder.
# If you set the following config variable to true then IE users
# will be forced to right hand click and save target for office
# documents.
$smb_cfg->cfgIEProtectMsOffice=true;
###################################################################
# Forces https protocol if set to true
$smb_cfg->cfgssl=false;
###################################################################
# Skips -N command line parameter (don't prompt for password)
# IMPORTANT - if you are using smb client version 3.4 or above then
# you need to set this parameter to true.
# to find out your version, simply type "smbclient --version" in a
# terminal (command prompt)
# Ubuntu 8.10 issues with smbclient:
# out of the box it won't work with shares using domain names,
# it will only work with IPs
# To fix this see the following url:
# [url="http://ubuntuforums.org/archive/index.php/t-909020.html"][ubuntu] Hardy Couldn't visit windows network with smbclient [Archive] - Ubuntu Forums[/url]
# OR - use Ubuntu 8.4 instead (works OK out of the box)
#
$smb_cfg->cfgSkipNoPwdParam=true;
?>

 

does that look right?

Edited by alunmjones
Posted

Rename the file to config_smb_web_client.bak, then paste this into a new file entitled config_smb_web_client.php:

 

$smb_cfg=new stdClass;
$smb_cfg->cfgWebserverType='windows'
$smb_cfg->cfgUserPrefix='LLANGEFNI/'; 
$smb_cfg->cfgWinShareToSmb=array(
'\\llangefni-dc'=>'LLANGEFNI/llangefni-dc'
);


$smb_cfg->cfgWinShares=array(
   'share1'=>array(
       'share'=>'LLANGEFNI/llangefni-dc/Staff Drive', 
       'title'=>'Staff Shared Area',
	'courses'=>array(1)
   ),
'share2'=>array(
       'share'=>'GUY-Q430/10.0.0.50/Documents', 
       'title'=>'Documents',
	'courses'=>array(1)
   ) 
);

$smb_cfg->cfgAllSharesSite=true;
$smb_cfg->cfgAnonymous = false;
$smb_cfg->cfgForceDownloads = true;
$smb_cfg->cfgMaxFolderZipSizeMB=0;
$smb_cfg->cfgCachePath = false;
$smb_cfg->cfgDefaultLanguage = 'en';
$smb_cfg->cfgDefaultCharset = 'ISO-8859-1';
$smb_cfg->cfgDefaultServer = 'localhost';
$smb_cfg->cfgSmbClient = 'C:\cygwin\bin\smbclient';
$smb_cfg->cfgAuthMode = 'SMB_AUTH_ARG_WIN';
$smb_cfg->cfgModRewrite = false;
$smb_cfg->cfgHideDotFiles = true;
$smb_cfg->cfgHideSystemShares = true;
$smb_cfg->cfgHidePrinterShares = true;
$smb_cfg->cfgLogLevel = 2;
$smb_cfg->cfgFacility = LOG_DAEMON;
$smb_cfg->cfgUserAuth = 'BasicAuth';
$smb_cfg->cfgSessionName = 'SMBWebClientID';
$smb_cfg->cfgAntivirus = false;
$smb_cfg->cfgArchiver = 'zip';
$smb_cfg->cfgInlineFiles = false;
$smb_cfg->cfgHomeDirField = '';
$smb_cfg->cfgIEProtectMsOffice=true;
$smb_cfg->cfgssl=false;
$smb_cfg->cfgSkipNoPwdParam=true;
?>

 

Give it a try and let me know how far you get. You'd missed the 'courses' section of each share's array, and you hadn't actually set the domain prefix for $smb_cfg->cfgUserPrefix - it still said 'domain/' rather than your actual domain.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...