2017年8月8日 星期二

Samba installation and configuration

Prepared
$  sudo apt update

Samba Server packages:
  1. samba
  2. samba-client
  3. samba-common

$ sudo apt install samba samba-client samba-common
$ sudo pdbedit --list
$ sudo pdbedit -a account_name -f"Account Fullname"
$ sudo smbpasswd -e account_name

$ sudo service --status-all
$ sudo service smbd restart
$ sudo service nmbd restart

Samba configuration: /etc/samba/smb.conf
    [global]
        workgroup = MYGROUP
            server string = Samba Server Version %v
            hosts allow = 127. 192.168.0.
            netbios name = server-name
            interfaces = eno1    # check your setting
            log file = /var/log/samba/log.%m
            max log size = 50
            security = user
            passdb backend = tdbsam
            dns proxy = no
            printing = cups
            printcap name = cups
            load printers = no
            cups options = raw
    [homes]
            comment = Home Directories 
            browseable = yes
            writable = yes
            guest ok = no
#            valid users = %S
           valid users = %S, %D%w%S
           inherit acls = Yes

Manage Samba account:
  1. List Samba account
  # sudo pdbedit --list
  2. Add Samba account by pdbedit
  # sudo pdbedit -a account_name -f"Account Fullname"
  3. Add Samba account
  # sudo smbpasswd -a account_name -f"Account Fullname"
  4. Enable Samba account
  # sudo smbpasswd -e account_name
  5. Disable Samba account
  # sudo smbpasswd -d account_name
  6. Delete Samba account
  # sudo smbpasswd -x account_name
  7. Change Samba password
  # sudo smbpasswd account_name

Restart Samba:
  1. for Ubuntu
        a. # sudo service --status-all
        b. # sudo service smbd restart
        c. # sudo service nmbd restart
  2. for CentOS
        a. # sudo systemctl list-units | grep smb
        b. # sudo systemctl list-units | grep nmb
        c. # sudo systemctl restart smb.service
        d. # sudo systemctl restart nmb.service
        e. # sudo systemctl status smb.service
        f. # sudo systemctl status nmb.service


Auto Start Samba:
  1. for Ubuntu
        a. # sudo update-rc.d samba defaults
        b. # sudo /var/log/samba/log.smbd
        c. # sudo /var/log/samba/log.nmbd
  2. for CentOS
        # sudo chkconfig smb on


Test Samba:
   1. Test your own computer's samba function, using GUI -- connect to server   smb://127.0.0.1/account_name
   2. Connection from other linux computer
   3. Connection from Windows computer


 

沒有留言:

張貼留言