next up previous contents
Next: ISCSI Up: SAMBA Previous: 安全機制   Contents

SAMBA 程式

  1. testparm
    ## testparm <options> <filename> <hostname IP_address> 
    
    [root@kvm8 ~]# testparm /etc/samba/smb.conf kvm8.deyu.wang 192.168.122.0/24
    Load smb config files from /etc/samba/smb.conf
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
    Processing section "[homes]"
    Processing section "[printers]"
    Processing section "[common]"
    Loaded services file OK.
    Server role: ROLE_STANDALONE
    Allow connection from kvm8.deyu.wang (192.168.122.0/24) to homes
    Allow connection from kvm8.deyu.wang (192.168.122.0/24) to printers
    Allow connection from kvm8.deyu.wang (192.168.122.0/24) to common
    

  2. smbstatus
    [root@kvm8 ~]# smbstatus 
    
    Samba version 3.5.10-114.el6
    PID     Username      Group         Machine                        
    -------------------------------------------------------------------
    
    Service      pid     machine       Connected at
    -------------------------------------------------------
    
    No locked files
    

  3. pdbedit
    [root@kvm8 ~]# pdbedit -a deyu1   ## 增加 samba 用戶
    new password:
    retype new password:
    Unix username:        deyu1
    NT username:          
    Account Flags:        [U          ]
    User SID:             S-1-5-21-3613796732-4223311700-2368206848-1000
    Primary Group SID:    S-1-5-21-3613796732-4223311700-2368206848-513
    Full Name:            
    Home Directory:       \\kvm8\deyu1
    HomeDir Drive:        
    Logon Script:         
    Profile Path:         \\kvm8\deyu1\profile
    Domain:               KVM8
    Account desc:         
    Workstations:         
    Munged dial:          
    Logon time:           0
    Logoff time:          Wed, 06 Feb 2036 23:06:39 CST
    Kickoff time:         Wed, 06 Feb 2036 23:06:39 CST
    Password last set:    Fri, 09 Aug 2013 23:44:29 CST
    Password can change:  Fri, 09 Aug 2013 23:44:29 CST
    Password must change: never
    Last bad password   : 0
    Bad password count  : 0
    Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    
    [root@kvm8 ~]# pdbedit -v -L deyu1  ## 列出用戶詳細資料
    Unix username:        deyu1
    NT username:          
    Account Flags:        [U          ]
    User SID:             S-1-5-21-3613796732-4223311700-2368206848-1000
    Primary Group SID:    S-1-5-21-3613796732-4223311700-2368206848-513
    Full Name:            
    Home Directory:       \\kvm8\deyu1
    HomeDir Drive:        
    Logon Script:         
    Profile Path:         \\kvm8\deyu1\profile
    Domain:               KVM8
    Account desc:         
    Workstations:         
    Munged dial:          
    Logon time:           0
    Logoff time:          Wed, 06 Feb 2036 23:06:39 CST
    Kickoff time:         Wed, 06 Feb 2036 23:06:39 CST
    Password last set:    Fri, 09 Aug 2013 23:44:29 CST
    Password can change:  Fri, 09 Aug 2013 23:44:29 CST
    Password must change: never
    Last bad password   : 0
    Bad password count  : 0
    Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    
    [root@kvm8 ~]# pdbedit -L deyu1
    deyu1:500:
    
    [root@kvm8 ~]# pdbedit -a deyu2
    new password:
    retype new password:
    Unix username:        deyu2
    NT username:          
    Account Flags:        [U          ]
    User SID:             S-1-5-21-3613796732-4223311700-2368206848-1001
    Primary Group SID:    S-1-5-21-3613796732-4223311700-2368206848-513
    Full Name:            
    Home Directory:       \\kvm8\deyu2
    HomeDir Drive:        
    Logon Script:         
    Profile Path:         \\kvm8\deyu2\profile
    Domain:               KVM8
    Account desc:         
    Workstations:         
    Munged dial:          
    Logon time:           0
    Logoff time:          Wed, 06 Feb 2036 23:06:39 CST
    Kickoff time:         Wed, 06 Feb 2036 23:06:39 CST
    Password last set:    Fri, 09 Aug 2013 23:48:06 CST
    Password can change:  Fri, 09 Aug 2013 23:48:06 CST
    Password must change: never
    Last bad password   : 0
    Bad password count  : 0
    Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    
    [root@kvm8 ~]# pdbedit -L        ## 列出用戶
    deyu1:500:
    deyu2:501:
    [root@kvm8 ~]# pdbedit -x deyu2  ## 刪除用戶 deyu2
    [root@kvm8 ~]# pdbedit -L        ## 再列出用戶
    deyu1:500:
    

  4. smbpasswd
    ## smbpasswd [options] [username]
    [root@kvm8 ~]# smbpasswd deyu1
    New SMB password:
    Retype new SMB password:
    

  5. smbclient
    ## smbclient <//server/share> <options>
    [root@kvm8 ~]# touch /public/aaa
    [root@kvm8 ~]# smbclient //kvm8.deyu.wang/common -U deyu1
    Enter deyu1's password: 
    Domain=[DEYUGROUP] OS=[Unix] Server=[Samba 3.5.10-114.el6]
    smb: \> dir
      .                        D        0  Sat Aug 10 00:03:50 2013
      ..                      DR        0  Fri Aug  9 23:26:43 2013
      aaa                               0  Sat Aug 10 00:03:50 2013
    
    		34646 blocks of size 32768. 6716 blocks available
    smb: \> exit
    



2018-03-16