Samba gets its name from the Server Message Block protocol, which is used by MS Windows to view shares across a Microsoft network. The service as it runs on Linux is known as smb.
Samba allows connectivity with Windows PCs, which allows Linux machines and their shares to be seen in Network Neighbourhood and for network printing.
The service itself is selectable on install as Samba Server under a custom installation of Red Hat (and Mandrake) Linux. To check for Samba, type:
rpm -qa | grep samba
If 'samba', 'samba-common' and samba-client' are all displayed, then it's installed. If not, install the Samba RPM from the RH CD (see Linux RPMs).
Getting Down to it
First create a shared directory, such as /usr/download
. If you wish for network users to have write permission, then change the permissions on the download
directory to others, write
(easiest way is to right click on the directory in X-Windows and put the extra 'X's in.
Break out the text editor; configuration of Samba consists of editing the file:
Although Samba is extremely configurable, I leave most of the defaults.
a) Change workgroup = yourworkgroup
selecting the name of your existing MS Windows workgroup
b) I Change security = share
so anybody can browse and access the directory. Keeping the default security=user will mean users have to provide a password, which exists on the Linux server. The latter might be preferable if the
machine will be directly connected to the internet or if specific security is required.
c) Under Red Hat, the bottom of this file has some example shares. You can use one of the examples and remove the ;
remarks from the beginning of each line. The sharename as seen from an MS Windows machine will be the title of the share which begins in brackets (see below). I tend to use the same name as the directory to be shared:
path = /usr/download
public = yes
writable = yes
The above are the main features needed to create the share. Make one entry in the smb.conf
file for each specific share on the system. The remarked-out examples demonstrate further functionality if required.
Save the file and start or restart the Samba service thus:
service smb start
or service smb restart
To test the service locally, type:
smbclient -L localhost
Your new share should be listed and viewable from an MS Windows machine.
To make Samba run from boot, type:
Scroll to the smb
entry and spacebar to put an asterisk next to it. Tab to save and exit. The Samba service will now start automatically on boot.
Mapping a Windows Share from Red Hat 7.1
This bit's for you, Kellie. Now some people like to do it the other way round as well. And why not. I find it makes for a bit of variety which, as they say, is the spice of life. Once Samba is up and running, create another directory on the Linux machine, such as /usr/map1
. This will be mapped to the MS Windows share called share1
Then use the Samba smbmount
command to map the MS Windows share to the required directory. You can use the Windows machine's Computername or IP Address:
smbmount //computername/sharename //linuxpath/linuxdirectory
i.e. smbmount //winbox/share1 //usr/map1
i.e. smbmount //192.168.0.1/share1 //usr/map1
The contents of the /usr/map1 directory should now be the Windows share.
Note that mounting drives has changed with Fedora Core, see Mapping a Network Share from Linux
(Fedora Core 5).
Note if your are mapping to a secure Windows machine such as NT/2000/XP/2003, then the user you are logged onto Linux with must be in the Windows user database. So if you are logged onto Linux as user root
with a password of dork
, then the username root with the same password must be added to the Windows users list before successful mapping can take place.