First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.
Configuring Samba 3.0 to act as a Windows File Server
- — 06 February, 2004 07:47
One of the most common roles for a Linux server on a predominately Windows network is as a file and printer server. The effectively free price of Linux makes it a very attractive alternative to the Windows server family. To act as a Windows file and printer server, Linux requires the Samba package, which implements the Windows file and printer sharing protocol (known as SMB or CIFS) under Linux/UNIX.
A copy of Samba 3.0.0 is included on the PC World January 2004 cover CD. Your Linux distribution may include a copy of an earlier version. Unless you want to use the advanced Active Directory features included in Samba 3.0.0, the version included with your distribution is suitable to perform the tasks outlined in this article.
To compile Samba from the cover CD, copy it to your hard drive and type the following in a shell:
$ bunzip2 -c samba-3.0.0.tar.bz2 | tar xv $ cd samba-3.0.0/source $ ./configure $ make
Once Samba has built, you will need to become the super user (if you are not already logged in as root) by typing ‘su’ and entering the root password. To install your freshly compiled copy of Samba, type the following:
$ make install
Samba uses plain text configuration files. The default version of each configuration file is loaded with helpful explanations of each setting and is well worth reading before making changes. The Samba configuration files are commonly located in /etc/samba/ or /usr/local/samba/lib/, but your distribution may place them elsewhere. The configuration file you need to edit is named smb.conf. Here is an example of an smb.conf file which will share a single directory on your Windows network. (Line numbers have been added to aid explanation; be sure to remove them if you copy the example into your own configuration file.)
1: [global] 2: workgroup = WORKGROUP 3: server string = Linux computer 4: [share1] 5: comment = Example share 6: path = /usr/local/public 7: public = yes
The first section of the smb.conf is the global configuration, as indicated by the header on line 1. In this section you can define settings, for example, the workgroup to which the server belongs (line 2), and the name attributed to the computer when listed on the network (line 3). Shared drives can be defined after the global section. Each shared drive must be given a name, such as share1 (line 4). Line 5 is a comment describing the purpose of the share. Line 6 specifies the path that will be shared under this share. Line 7 allows the share to be mounted without the need to enter a password.
Once you have tweaked your configuration settings in smb.conf, it is important to test them with the testparm program. Type the following in a shell to verify your configuration settings:
$ testparam /etc/samba/smb.conf
To start the Samba server, as root type the following in a shell:
You should now be able to see your Linux computer on your Windows network when exploring the Network Neighbourhood.
If you have trouble connecting to your Samba server because of a bad password, you will need to add a user to your Samba password file. To do this, type:
$ smbpasswd -a
You will be prompted to enter the password for the user twice before the account is created. Creating a Samba user requires a user with the same name that already exists on your Linux computer.
More advanced Samba documentation can be found in the Samba HOWTO located at: http://au1.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
Browsing Windows servers under Linux
Samba also includes a handy client, creatively named smbclient, which can be used to test your Samba server or to browse other Windows servers. To connect to a Windows server using smbclient, type the following:
$ smbclient //servername/sharename -U username
Change username to a working system login for the computer you are connecting to. After connecting you will be greeted with a prompt similar to:
From here you can use many standard FTP commands such as:
cd — change directory dir — list directory contents get
— download to your computer put — upload to the server
A full list of commands is provided in the smbclient man page which can be accessed by typing:
$ man smbclient