A common way to share files across different computer systems is to install and configure Samba as a standalone file server.
Samba remains a very popular open source distribution and here we look at how to deliver an instant approach to file sharing that provides seamless integration for any number of users on any type of modern computer across your entire working environment.
This assumes that you are using a
Static IP address.
If you are running a firewall, you will need to confirm that the firewall has been disabled, removed, or the appropriate ports are open. Similarly, if you are running SELinux, then you should confirm that it has been disabled or it is now running in permissive mode.
First download and install the necessary packages
$ sudo yum install samba samba-client samba-commmon
Now rename the original configuration file
$ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Create a new configuration file in your preferred text editor
$ sudo vi/etc/samba/smb.conf
Build your new configuration by adding the following lines, substituting the values shown with your own.
[global]
unix charset = UTF-8
dos charset = CP932
workgroup = <WORKGROUP_NAME>
server string = <MY_SERVERS_NAME>
176
Chapter 6
netbios name = <MY_SERVERS_NAME>
dns proxy = no
wins support = no
interfaces = 127.0.0.0/8 XXX.XXX.XXX.XXX/24 ethX
bind interfaces only = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog only = no
syslog = 0
panic action = /usr/share/samba/panic-action %d
MY_SERVERS_NAME refers to the name of your server. In most
situations this could be in the form of FILESERVER or SERVER1
and so on.
ethX refers to the name of your primary Ethernet interface. In
most situations this could be eth0.
XXX.XXX.XXX.XXX/XX refers to the primary network address.
This will be something similar to 192.168.1.100/24.
Now configure Samba as a standalone server. Continue to
add the following lines to your main configuration file
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\
spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = no
We do not want to configure Samba as a domain
master or master browser so we add the following
domain master = no
local master = no
preferred master = no
os level = 8
Now add support for home directory sharing by enabling valid users to
access their home directories. This feature will support the appropriate read/write
permissions and all folders will remain private from other users. Add as below
[homes]
comment = Home Directories
browseable = no
writable = yes
valid users = %S
create mask =0755
directory mask =0755
Save and close the file then ensure
that the samba service will start during the boot process.
$ sudo chkconfig smb on && chkconfig nmb on
Start the Samba server by typing as root
# service smb start && service nmb start
See also
Samba hide files and folders.