SAMBA FileServer configuration
Posted: 2023 May 03, 19:42
Created a separate partition for the fileserver, to keep order, and not to have all the files/services in the same place.
Below is an example of partitioning done on the server
Install SAMBA package
or
SAMBA configuration file smb.conf (modified)
Creating SAMBA users is done by running the command
Starting the SAMBA file server
or
Below is an example of partitioning done on the server
Code: Select all
[root @ centos ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 49G 15G 32G 32% /
tmpfs 1.9G 888K 1.9G 1% /dev/shm
/dev/sda7 13G 314M 12G 3% /backups
/dev/sda2 78G 1.3G 73G 2% /fileserver
/dev/sda3 59G 2.3G 54G 5% /home
/dev/sda6 30G 578M 28G 3% /tmp
Code: Select all
[root @ centos ~]$ yum install samba
Code: Select all
[root @ debian ~]$ apt-get install samba
Code: Select all
[root @ centos ~]$ nano /etc/samba/smb.conf
#Samba config
[global]
workgroup = workgroup
server string = %h server
name resolve order = bcast host
; wins support = no
; dns proxy = no
; name resolve order = lmhosts host wins bcast
interfaces = 127.0.0.0/8 eth0 eth1
; bind interfaces only = true
# hosts allow = 127.0.0.1
# hosts deny = 0.0.0.0/0
hosts allow = 127.0.0.1 0.0.0.0/0
log file = /var/log/samba/log.%m
max log size = 1000
syslog only = no
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = user
encrypt passwords = true
passdb backend = smbpasswd
smbpasswd file = /etc/samba/passwords
username map = /etc/samba/usermap.conf
obey pam restrictions = yes
; guest account = nobody
invalid users = root
veto files = /lost+found/
; disable printing
load printers = no
disable spoolss = yes
; unix password sync = no
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .
; pam password change = no
; domain logons = yes
socket options = TCP_NODELAY
#======================= Share Definitions =======================
[all]
path = /fileserver/samba/all
browseable = yes
read only = no
guest ok = yes
force user = root
create mask = 660
directory mask = 770
valid users = %U
strict locking = Yes
valid users = user1 user2
[test]
path = /fileserver/samba/test
browseable = yes
read only = no
guest ok = no
force user = root
create mask = 660
directory mask = 770
users = user3
;[printers]
;comment = All Printers
;path = /var/spool/samba
;browseable = no
;guest ok = no
;writable = no
;printable = yes
Code: Select all
[root @ centos ~]$ smbpasswd -a user1
Code: Select all
[root @ centos ~]$ /etc/init.d/smb start
Code: Select all
[root @ centos ~]# service smb start