Setup Samba Daemon from Source Code

Reference
Source tarball:
https://download.samba.org/pub/samba/samba-3.0.37.tar.gz
Build and Installation
./autogen.sh && ./configure && make && make install
Configure
After installation, you will find samba files in/usr/local/samba .
  • bin all the utility tools here
  • lib the common libraries here, and the default configuration file smb.conf located here
  • sbin the daemon binaries nmbd & smbd here

  • A simple example configuration file:
    [global]
             workgroup = MYGROUP
             server string = Samba Server %v
             security = user
             log file = /var/log/samba/%m.log
             passdb backend = smbpasswd
             smb passwd file = /etc/samba/smbpasswd
    [root]
             path = /
             valid users = root
             writeable = yes
    [public]
             path = /tmp
             guest ok = yes
             read only = yes
    

    Add samba user
    Note: a samba user must be a system user first, (adduser/useradd system utilities). Note: make sure smbpasswd file exists in/etc/samba/smbpasswd, if not, touch it first. Note: make sure smb.conf file exists in/usr/local/samba/lib/smb.conf, if not, configure it as above;
    as an example, add root to samba’s smbpasswd file;
    #!/bin/bash
    /usr/local/samba/bin/smbpasswd -a root
    Enter password:
    balabala....
    Retry password:
    balabala....
    Added root as samba user.

    Check configuration
    #!/bin/bash
    /usr/local/samba/bin/testparm
    

    Startup
    #!/bin/bash
    /usr/local/samba/sbin/smbd -D
    /usr/local/samba/sbin/nmbd -D
    pgrep -x nmbd && pgrep -x smbd
    echo "Done"

    it is also available to specify a smb.conf for smbd & nmbd with -s option;
    Test with smbclient
    list
    #!/bin/bash
    /usr/local/samba/bin/smbclient -L //127.0.0.1/ -U root
    Enter Password:
    
    Domain=[HARRY-VIRTUALBOX] OS=[Unix] Server=[Samba 3.0.37]
    
        Sharename       Type      Comment
        ---------       ----      -------
        root            Disk      
        public          Disk      
        IPC$            IPC       IPC Service (Samba Server 3.0.37)
    Domain=[HARRY-VIRTUALBOX] OS=[Unix] Server=[Samba 3.0.37]
    
        Server               Comment
        ---------            -------
    
        Workgroup            Master
        ---------            -------
        MYGROUP              HARRY-VIRTUALBOX
        WORKGROUP            HARRYBOT

    use it
    #!/bin/bash
    /usr/loca/samba/bin/smbclient //127.0.0.1/root -U root
    Password:.....
    Domain=[HARRY-VIRTUALBOX] OS=[Unix] Server=[Samba 3.0.37]
    smb: \> ls
      .                                   D        0  Wed Dec  2 10:52:00 2015
      ..                                  D        0  Wed Dec  2 10:52:00 2015
      mnt                                 D        0  Mon Oct 19 17:14:38 2015
      proc                               DR        0  Fri Feb 12 16:33:13 2016
      media                               D        0  Wed Oct 21 23:49:12 2015
      etc                                 D        0  Sat Feb 13 16:06:17 2016
      home                                D        0  Fri Feb 12 22:46:27 2016
      run                                 D        0  Sat Feb 13 15:18:23 2016
      root                                D        0  Sat Feb 13 15:59:06 2016
      opt                                 D        0  Wed Oct 21 23:49:12 2015
      cdrom                               D        0  Wed Dec  2 10:22:38 2015
      srv                                 D        0  Wed Oct 21 23:49:12 2015
      lib64                               D        0  Wed Oct 21 23:49:20 2015
      usr                                 D        0  Wed Jan 13 14:14:03 2016
      vmlinuz                                6797696  Wed Dec  2 10:21:56 2015
      var                                 D        0  Tue Dec  8 15:46:27 2015
      lost+found                          D        0  Wed Dec  2 10:18:54 2015
      tmp                                 D        0  Sat Feb 13 16:18:12 2016
      initrd.img                            33669308  Wed Dec  2 10:52:58 2015
      sys                                DR        0  Fri Feb 12 16:33:08 2016
      boot                                D        0  Wed Dec  2 10:52:58 2015
      bin                                 D        0  Wed Dec  2 10:52:39 2015
      sbin                                D        0  Fri Feb 12 22:36:20 2016
      lib                                 D        0  Fri Dec 18 22:35:25 2015
      dev                                 D        0  Sat Feb 13 03:02:07 2016
    
            39433 blocks of size 1048576. 28119 blocks available
    smb: \>

    access from windows 7
    net use x: \\192.168.56.101\root /user:root /persistent:yes 
    Enter password: ....

    좋은 웹페이지 즐겨찾기