|45 Drives Knowledge Base
||KB450010 - Single Server Linux SMB Setup
Logon to your CentOS with the admin account, default is: username=root, password=password
Next, to install the necessary packages run the following command:
yum -y install samba samba-client samba-common
Editing the configuration file can be done using any text editor (vi, vim, nano, etc).
To use vi, enter i to make changes to the text. When done, hit the Esc key, and then enter :wq to save and exit.
Run the following command to edit the necessary configuration file:
Once in the file, you’ll need to change the section to the following:
workgroup = WORKGROUP security = user map to guest = bad user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw
Below the section, add your share definition in the same format. The first example is a share called “Storage” that will allow everyone to have access to the /mnt/data directory :
path = /mnt/data browsable = yes writeable = yes force user = nobody force group = nobody read only = no guest ok = yes
Once you exit the text editor, you’ll need to run the following command:
chown -R nobody:nobody /mnt/data
The above settings will not prompt anybody for a username or password when connecting to the share.
Below is an example of a share that prompts users for a username and password before given access:
path = /mnt/data valid users = @securedgroup guest ok = no writeable = yes browsable = yes
For this method to work, you will now need to create a group, in our example it is called ‘securegroup’, and then create all the users you want to give access to the share. This can be done with the following commands:
groupadd securegroup useradd username –G securegroup smbpasswd –a username
You must enable to smb service and update firewall settings by running the following commands:
systemctl enable smb systemctl restart smb firewall-cmd --add-service=samba --permanent firewall-cmd --reload
To access the Samba share on a Windows client, go to “Computer” and then “Map Network Drive”
Enter the IP address and the Share name in the format shown below: