samba.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1728 3ddb79eb60f9
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
     1
.. -*- coding: utf-8 -*-
1728
3ddb79eb60f9 With missing header resulted html output has different structure that
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
     2
.. include:: HEADER.rst
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
     4
========
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
     5
 Samba.
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
     6
========
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
     7
.. contents::
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
     9
Installing smbfs.
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    10
=================
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    11
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    12
Install smbfs package::
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  $ apt-get install smbfs
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    16
Create new group::
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
  $ groupadd smbgrp
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    20
Add permitions for user that may used mount point::
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
  $ useradd me smbgrp
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  $ useradd you smbgrp
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    25
Make password file::
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
  $ cat >/etc/.smbpass
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
  username=<smb-user>
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
  password=<smb-pass>
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  domain=<WORKGROUP>
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
  ^D
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    33
Make mount point::
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
  $ mkdir /mnt/smb
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
  $ chgrp smbgrp /mnt/smb
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
  $ chmod 770 /mnt/smb
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    39
Add this line to ``/etc/fstab``::
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
  XXX correct uid=root,gid=smbgrp,umode=775,fmask=775
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
  //192.168.xx.xx/share-point  /mnt/smb  smbfs  rw,credentials=/etc/.smbpass,uid=root,gid=smbgrp,umode=775,fmask=775
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    44
Recursively getting files.
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    45
==========================
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    46
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    47
You can use ``TAB``completion in ``smbclient``::
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    48
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    49
  $ mkdir $DEST
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    50
  $ cd $DEST
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    51
  $ smbclient -U $DOMAIN/$DOMAINUSER //$IP/$SHARE $DOMAINPASSWORD
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    52
  smb> prompt
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    53
  smb> recurse
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    54
  smb> mget directory\
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    55
  ...
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    56
  smb> quit
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
1705
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    58
Alternative syntax to run ``smbclient``::
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    59
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    60
  $ smbclient -U $USER //$IP/$SHARE $PASSWORD
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    61
  ...
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    62
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    63
or::
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    64
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    65
  $ smbclient -U $USER //$IP/$SHARE
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    66
  Password:
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    67
  ...
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    68
1705
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    69
Alternative syntax for ``smbclient`` and additional commands::
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    70
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    71
  mask ""
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    72
  recurse ON
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    73
  prompt OFF
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    74
  cd 'path\to\remote\dir'
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    75
  lcd '~/path/to/local/dir'
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    76
  mget *
0e0d3d3337a0 Alternative syntax for ``smbclient``
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
    77
1704
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    78
To list all available shares::
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    79
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    80
  $ smbclient -U $USER -L //$IP
57cb0966464c Recursively getting files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 8
diff changeset
    81