How to setup a Samba Server
Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients.” Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients. If you would like to setup a server so Windows users can access shared directories, this tutorial is for you.
To install:
- In Ubuntu: sudo apt-get install samba smbfs
- In Suse: zypper in samba smbfs
- In Fedora: yum install samba smbfs
How to add/edit/delete network users
As root:
- smbpasswd -a system_username
- nano /etc/samba/smbusers
Insert the following line into the new file
- system_username = “network username”
Save the file.
To add network user
- (as root): smbpasswd -a system_username
To delete network user
- (as root): smbpasswd -x system_username
To enable network user (By Default network users are disabled after adding them, make sure you run the enable network user command.)
- (as root): smbpasswd -e system_username
To disable network user
- (as root): smbpasswd -d system_username
How to share home folders with read only or read/write permission with authentication
- (as root): cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
- (as root): nano /etc/samba/smb.conf
Find this line
- ; security = user (note the semicolon)
Replace with the following lines
- security = user
- username map = /etc/samba/smbusers
Remove the ; in front of the following lines (there will text in between explaining what they do):
;[homes]
;comment = Home Directories
;browseable = no
;valid users = %S
;writable = yes
If you want other network users to be able to edit to the folder then change
# By default, the home directories are exported read-only. Change next
# parameter to ‘yes’ if you want to be able to write to them.
; writable = no
Replace with the following lines
- writable = yes
And save the file.
- (as root): testparm
- (as root): /etc/init.d/samba restart







