Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


problems with samba share
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

problems with samba share

WilliamWilliam Member
edited April 2013 in Help

I have problems with a new samba server (never used it before either), i have a few CIFS (Windows shares) mounted in /mount, with commands like this:

mount -t cifs -o username=Administrator,uid=smbmnt,gid=smbmnt //192.168.1.23/Backups /mount/NAS5-Backups/

My smb.conf is as follows:

[global]
        server string = %h server
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        smb ports = 445
        dns proxy = No
        panic action = /usr/share/samba/panic-action %d
        invalid users = root

[homes]
        comment = Home Directories
        valid users = %S
        create mask = 0700
        directory mask = 0700
        browseable = No

[Storage]
        comment = Storage NAS
        path = /mount/NAS5-Backups
        read only = No

Now i can mount the share on my Win client fine, it works and i can "write through" to the other share - However, this is not what i intended - i basically want to mount N shares in /mount (/mount/NAS4, NAS5 etc) and then have one Samba share over it that i can mount on another machine (behind VPN/LAN) that grants rw permissions like the other shares would be normal dirs.
Something like a CIFS low level mount would fit, but i found nothing in that regard

Any ideas? i'm also open for other sharing methods as long as they are fast, can be mounted on Windows as drive and let me achieve the above.

Comments

  • MunMun Member

    Why are you using SMB, there are a ton of better and more secure options.

  • Then how about you list some...

  • gbshousegbshouse Member, Host Rep

    Try NFS or iSCSI

  • WilliamWilliam Member
    edited April 2013

    ISCSI is not useable as it is no real disk and Windows will want to format it after creation - but i'll have a look at NFS
    EDIT: NFS is out as well, cannot mount folders which already have other mounts in it (shown as empty on the client)

  • pcanpcan Member

    @William: Are you trying to build a hierarchical structure? A "master" share that the client will use (as example a drive labeled N: on a Windows client), and lower-level shares are inside this one (as example: N:\share1 is the first share, N:\share2 the second, N:\share3 the third...). This is done with the dfs management console on a Windows domain controller. It works pretty well, it also can mirror data between shares automatically, when required.

  • Yes, exactly!
    Any special software or network setup required to use a 2008 R2 Standard as Domain controller?

  • mikhomikho Member, Host Rep

    If I understand tour question, then no special software is needed.

    Install win2008 and add the roles after.

  • pcanpcan Member

    As MikHo said, no special software is needed, but each computer joined to the domain should be licensed with the usual CAL. The step-by step guide for Windows 2008 is here: http://technet.microsoft.com/en-us/library/cc732863(v=ws.10).aspx ; 2008R2 is basically the same, while Windows2012 is different. The namespace could be created for non-domain joined computers if you don't require replication, but I never tried this configuration.

  • As this requires 2008 Domaincontroller (which is damn expensive) i settled for a different way.

    I kept the 2 shares per NAS and use NTFS junctions and a local script to symlink all of the second HDD array to the first one (NTFS junctions, unlike symlinks, also work over a shared directory as they are locally processed and redirected to the second HDD).
    -> 1 share per node

    For my 'special' nas that uses 2 nodes i used iSCS Target on the second one to expose the HDDs, mount them on the first one (as NTFS junctions can only be created on local volumes, not remote mounted) via iSCSI initiator and they behave like local disks, then did junctions as above.

    Does not solve my initial problem but i simply circumvented the share that 'reshares' on this Samba server :)

  • WilliamWilliam Member
    edited April 2013

    Edith: more comments in the scripts

    Heres the scripts (bash, requires cygwin) for the interested:

    Makes new junctions, just cron it, self detection if it already exists

    #!/bin/bash
    #####
    #This script is made for Cygwin. It will NOT RUN on a linux system and likely cause damage.
    #william AT william DOT si
    #Case was a server running 4x 2TB in Raid1 and 2 iSCSI mounts also with 2TB each
    #these hold dirs than can simply be symlinked to one main dir
    #so this script goes through all targets and symlinks as required
    
    #full path, must be cygwin readable
    sourcedrive1="/cygdrive/e/"
    targetdrive="/cygdrive/d/"
    #####
    #convert /cygdrive syntax to windows
    winsrc=$(echo $sourcedrive1 | sed -e "s/\/cygdrive\///" -e "s/\///")
    wintrg=$(echo $targetdrive | sed -e "s/\/cygdrive\///" -e "s/\///")
    #get list, exclude some windows default items
    for i in $(ls -1 $sourcedrive1 | egrep -v '(RECYCLE.BIN|System Volume Information)'); do
                    #check if dir already exists, i use -d as it returns 0 if the junction is broken/dead unlike -x and it will automatically be recreated then
                    if [ -d $targetdrive$i ]; then
                            #on cygwin, an if block requires content, so we echo some bs here
                            echo "$i already existing - skipping"
                    else
                            #sleep to avoid disk IO raping
                            sleep 0.05
                            #mklink is a function of cmd.exe, not a binary
                            cmd.exe /c "mklink /J $wintrg:\\$i $winsrc:\\$i"
                    fi
    done
    

    Checks existing junctions and echoes recommendations for removals

    #!/bin/bash
    #####
    #This script is made for Cygwin. It will NOT RUN on a linux system and likely cause damage.
    #check for dead NTFS junctions (due to move of files etc.) and delete them
    target="/cygdrive/d/"
    ###
    #DO NEVER USE rm -r OR THE RECURSIVE ACTION WILL WIPE THE DIRECTORY CONTENT
    ###
    #get list, exclude some windows default items
    for i in $(ls -1 $target | egrep -v '(RECYCLE.BIN|System Volume Information)'); do
                    #check if target exists, -d defaults to 0 if the junction is dead and 1 if it works (as a junction without target is a simple file, with it the overlay is a folder)
                    if [ -d $target/$i ]; then
                            #content required by cygwin, false should not do anything
                            false
                    else
                            echo "$i is dead"
                            #remove the echo if you want the script to work full automatic
                            echo "rm $target$1"
                    fi
    done
    
  • Note: I upgraded to 2012 now and use Storage spaces + DFS (which somehow works on 2012 Standard as well).

    Works fine but rather slow in RAID5 (slow CPU), biggest plus is data deduplication and bitlocker encryption.

Sign In or Register to comment.