If independently installing the software package for your hosting project is your goal, then you might consider choosing one of the many free components out there. Sooner or later you are bound to encounter the widely used and very popular LAMP stack software bundle. But what exactly makes this package so attractive in comparison to alternative options?LAMP Servers: an affordable solution for dynamic websites
Samba Server - The solution for a cross-platform network
What is a Samba server?
A Samba server refers to a server that is supported by the free software suite, Samba. With the help of Linux and Unix distributions, the GNU licensed package is able to implement SMB protocols (the suite’s namesake). The server message block (SMB) protocol, also known as common internet file system (CIFS), was originally used for file, printing, and other services for Microsoft Windows operating systems. Samba servers support Windows, Linux, and Unix integration systems, making it possible to share files or use printers on any operating system. Since the launch of version 4, Unix and Linux Samba servers have taken over the role of Active Directory domain controllers, which allow central authorization and authentication for both computers and users.
Samba servers are made up of several modules, allowing SMB or CIFS protocols to be configured. The following four daemons (systems that run in the background) are at the core of the Samba server:
- samba: this daemon was added in version 4 and enables the Active Directory domain controllers. It is configured in the file smb.conf.
- smbd: this enables file and printer sharing and is configured with smb.conf.
- mbd: this is responsible for terminating NetBIOS names in IP addresses and can also be configured with smb.conf.
- winbindd: winbindd resolves group and user information, making it intelligible for Unix and Linux systems. It offers stand-alone configuration options.
How to install a Samba server
SMB/CIFS is the standard protocol for uncomplicated network sharing on Windows systems. However, when computers with Linux or Unix operating systems belong to the network, exchanging and sharing files becomes a more difficult task. By installing a Samba server, which connects individual devices, these compatibility problems are solved. Since the Samba package consists of open source components, there are no additional costs. The following steps outline how to install a Linux Samba server.
Step 1: installation
First, decide whether to operate directly on your server or from a client via remote access. Then enter the following command in order to install the Samba package onto the server:
apt-get install samba
Step 2: create a user account for the Samba database
After installing the Samba server, the user account must be activated. Some Linux distributions automatically synchronize the user accounts in the network and add the Samba database. If the package libpam-smbpass is already installed on the server, the Linux and SMB passwords will be synchronized. Otherwise, all accounts have to be created manually for the users to be able to access the respective network services.
The account can be set up using the command smbpasswd with the four parameters -a, -x, -d and -e. The corresponding command lines will appear as follows:
sudo smbpasswd -a USERNAME (PASSWORD) sudo smbpasswd -x USERNAME sudo smbpasswd -d USERNAME sudo smbpasswd -e USERNAME
The first command adds the user to the Samba server database and enables network sharing. Directly following the username, the user may covertly set or change a password. It can be identical or differ to the Linux password. The second command (-x) removes the user from the database, the -d parameter deactivates the account, and -e reactivates it. The command
sudo service smbd reload
reloads the server configuration in order to accept new changes.
Step 3: configure file sharing
Global settings can be set in the Samba server configuration file. The resource permissions and the server’s global properties are saved here. The file is opened with the following command:
sudo gedit /etc/samba/smb.conf
The file smb.conf contains many examples that are commented out, which are identified either by a hash (#) or semicolon (;) and are inactive. Should you wish to activate one of these examples, simply delete the additional character. New entries can be inserted at the end of the file. Firstly, specify the global name in square brackets under which the shared resource is available. The next lines describe the path to the respective folder or file as well as the applicable parameters. For example, to share a folder with photos, allowing the user writing access as well as guest user access, the entry in the smb.conf is needed:
[Photos] path= /documents/photos writeable = yes guest ok = yes
To accept the changes, reload Samba by executing the following command:
sudo service smbd reload
In order to set up user-specific resource sharing, the user needs to belong to the group sambashare. The following command adds the user to this group:
sudo usermod -aG sambashare USERNAME
Login again or restart Linux to confirm group membership. If the user is setting up clearances, these will no longer be saved in the smb.conf; rather, they will now be found in a separate text file, usually /var/lib/samba/usershares. All of these files include the share name and approval path, an optional comment, the user share ACL (which indicates whether the shared folder can be edited or whether it is read-only) as well as a parameter that shows who has access to the file. For example:
net usershare add Photos /documents/photos ‘holiday 2015’ Everyone: r, USER1: f
This command allows the folder with the sharename ‘Photos’ in the path ‘/documents/photos’ and the comment ‘holiday 2015’ to be shared. All Samba server user accounts can read the folder. USER1 has the full rights and can change the settings. The following command can be used to check the folder:
net usershare list net usershare info
The first command lists all the shared folders under the respective sharename, while the second gives details like comments, rights, etc. If the user wishes to make changes to the folder, the values should always be entered on the command line, rather than in the usershares text file. Approvals can be deleted with the command:
net usershare delete SHARENAME
Samba server: Windows and Linux united in one network
With the joint use of printers and files in one network, a Samba server and Samba client software provides an elegant solution to problems caused by different operating systems. The free software suite implements the network protocol SMB/CIFS in Unix and Linux systems and by doing so makes them compatible with Windows distributions in the network – both servers and clients.
Due in part to its new role as Active Directory Domain Controller, a Linux Samba server manages the sharing of data and services in networks such as Windows servers. Those who want to install a Samba server can easily do so from their personal computer via remote access. Users also have the choice of working directly on the command line or installing a graphic interface for simplicity’s sake