Samba

refs: Ubuntu Samba Server Guide

Ubuntu sharing settings

There are several ways to do sharing on Ubuntu:

Right-click Sharing

Object

Samba via CLI

Ubuntu Samba via CLI Tutorial

config user and password:

$ sudo smbpasswd -a lee
New SMB password:
Retype new SMB password:
Added user lee.

$ sudo pdbedit -L
nobody:65534:nobody
lee:1000:Gary Li

a usable conf:

[global]
        security = user
        encrypt passwords = true
        map to guest = bad user
        guest account = nobody

private

[private]
        comment = Private Share
        path = /path/to/share/point
        browseable = no
        read only = no

public

[public]
        comment = Public Share
        path = /path/to/share/point
        read only = no
        guest only = yes
        guest ok = yes

allow samba to follow symbolic links, add the following two settings to smb.conf

# whether allow follow symlinks
wide links = yes
# whether implements CIFS UNIX extension
unix extensions = no

command line confs and tools

server conf

smb.conf (5)         - The configuration file for the Samba suite
smbd (8)             - server to provide SMB/CIFS services to clients

server status:

smbstatus (1)        - report on current Samba connections

$ sudo smbstatus

Samba version 4.1.6-Ubuntu
PID     Username      Group         Machine                        
-------------------------------------------------------------------
20682     lee           lee           jcifs0_1_ea  (ipv4:192.168.115.31:47285)

Service      pid     machine       Connected at
-------------------------------------------------------
share        20682   jcifs0_1_ea   Thu Mar 17 13:12:29 2016

server list and access:

smbtree (1)          - A text based smb network browser
smbclient (1)        - ftp-like client to access SMB/CIFS resources on servers

$ smbtree
Enter lee's password: 
WORKGROUP
    \\LEE-UBUNTU            lee-ubuntu server (Samba, Ubuntu)
        \\LEE-UBUNTU\lee                Home Directories
        \\LEE-UBUNTU\share              
NAS
    \\WEBNAS                NAS Server
        \\WEBNAS\home               Home

$ smbclient -U lee '\\LEE-UBUNTU\share'
Enter lee's password: 
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.6-Ubuntu]

smb: \> ?
?              allinfo        altname        archive        backup         
blocksize      cancel         case_sensitive cd             chmod          
chown          close          del            dir            du             
echo           exit           get            getfacl        geteas         
hardlink       help           history        iosize         lcd            
link           lock           lowercase      ls             l              
mask           md             mget           mkdir          more           
mput           newer          notify         open           posix          
posix_encrypt  posix_open     posix_mkdir    posix_rmdir    posix_unlink   
print          prompt         put            pwd            q              
queue          quit           readlink       rd             recurse        
reget          rename         reput          rm             rmdir          
showacls       setea          setmode        stat           symlink        
tar            tarmode        timeout        translate      unlock         
volume         vuid           wdel           logon          listconnect    
showconnect    tcon           tdis           tid            logoff         
..             !              
smb: \> l

samba user management:

smbpasswd (5)        - The Samba encrypted password file
smbpasswd (8)        - change a user's SMB password
pdbedit (8)          - manage the SAM database (Database of Samba Users)

another command samba-tool is used only when you setup Samba for Active Directory

use pdbedit to list all samba users

$ sudo pdbedit -L 
nobody:65534:nobody
lee:1000:Gary Li