samba.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:46:36 +0200
changeset 1905 fba288d59662
parent 1728 3ddb79eb60f9
child 1911 870693ce6ff0
permissions -rw-r--r--
Include only local subsections into TOC. This prevent duplication of TOC when build single page HTML document. Also this make unnecessary CSS hack to hide document title as top level section.

.. -*- coding: utf-8 -*-
.. include:: HEADER.rst

========
 Samba.
========
.. contents::
   :local:

Installing smbfs.
=================

Install smbfs package::

  $ apt-get install smbfs

Create new group::

  $ groupadd smbgrp

Add permitions for user that may used mount point::

  $ useradd me smbgrp
  $ useradd you smbgrp

Make password file::

  $ cat >/etc/.smbpass
  username=<smb-user>
  password=<smb-pass>
  domain=<WORKGROUP>
  ^D

Make mount point::

  $ mkdir /mnt/smb
  $ chgrp smbgrp /mnt/smb
  $ chmod 770 /mnt/smb

Add this line to ``/etc/fstab``::

  XXX correct uid=root,gid=smbgrp,umode=775,fmask=775
  //192.168.xx.xx/share-point  /mnt/smb  smbfs  rw,credentials=/etc/.smbpass,uid=root,gid=smbgrp,umode=775,fmask=775

Recursively getting files.
==========================

You can use ``TAB``completion in ``smbclient``::

  $ mkdir $DEST
  $ cd $DEST
  $ smbclient -U $DOMAIN/$DOMAINUSER //$IP/$SHARE $DOMAINPASSWORD
  smb> prompt
  smb> recurse
  smb> mget directory\
  ...
  smb> quit

Alternative syntax to run ``smbclient``::

  $ smbclient -U $USER //$IP/$SHARE $PASSWORD
  ...

or::

  $ smbclient -U $USER //$IP/$SHARE
  Password:
  ...

Alternative syntax for ``smbclient`` and additional commands::

  mask ""
  recurse ON
  prompt OFF
  cd 'path\to\remote\dir'
  lcd '~/path/to/local/dir'
  mget *

To list all available shares::

  $ smbclient -U $USER -L //$IP