REDHAT 5 – SAMBA

Posted: September 7, 2010 in REDHAT 5 LinUX

SAMBA

Introduction

Samba is a suite of utilities that allows your Linux box to share files and other resources, such as printers, with Windows boxes. This chapter describes how you can make your Linux box into a Windows Primary Domain Controller (PDC) or a server for a Windows Workgroup. Either configuration will allow everyone at home to have:

  • their own logins on all the home windows boxes while having their files on the Linux box appear to be located on a new Windows drive
  • shared access to printers on the Linux box
  • shared files accessible only to members of their Linux user group.

What’s the difference between a PDC and Windows Workgroup member? A detailed description is beyond the scope of this chapter, but this simple explanation should be enough:

  • A PDC stores the login information in a central database on its hard drive. This allows each user to have a universal username and password when logging in from all PCs on the network.
  • In a Windows Workgroup, each PC stores the usernames and passwords locally so that they are unique for each PC.

Download and Install Packages

Most RedHat and Fedora Linux software products are available in the RPM format. Downloading and installing RPMs isn’t hard. If you need a refresher..

Samba is comprised of a suite of RPMs that come on the Fedora CDs. The files are named:

  • samba
  • samba-common
  • samba-client
  • samba-swat

When searching for the file, remember that the RPM’s filename usually starts with the RPM name followed by a version number as in samba-client-3.0.0-15.i386.

How to Get Samba Started

  • You can configure Samba to start at boot time using the chkconfig command:

[root@bigboy tmp]# chkconfig smb on

  • You can start/stop/restart Samba after boot time using the smb initialization script as in the examples below:

[root@bigboy tmp]# service smb start

[root@bigboy tmp]# service smb stop

[root@bigboy tmp]# service smb restart

Sometimes Samba may have an ancillary nmb daemon that also needs to be started. The syntax is the same as that for the smb daemon.

[root@bigboy tmp]# service nmb start

[root@bigboy tmp]# service nmb stop

[root@bigboy tmp]# service nmb restart

The Samba Configuration File

The /etc/samba/smb.conf file is the main configuration file you’ll need to edit. It is split into five major sections

Section                                       Description

[global]               General Samba configuration parameters

[printers]            Used for configuring printersUsed for configuring printers

[homes]               Defines treatment of user logins

[netlogon]          A share for storing logon scripts. (Not created by default.)

[profile]               A share for storing domain logon information such as “favorites” and desktop icons.         (Not created by default.)

How To Create A Samba Administrator User

By default, the root user is the Samba administrator, And the Linux root password to be used. Fortunately, you can add workstations to the Windows domain by creating a Samba specific root password. This is done using the smbpasswd command.

[root@bigboy tmp]# /usr/bin/smbpasswd -a root password

Remember that regular Linux logins via the console, Telnet or SSH require the Linux passwd command. Samba domain logins use the smbpasswd password. Samba passwords are stored in the /etc/samba/smbpasswd file.

Command Line Configuration

Samba uses /etc/samba/smb.conf as its configuration file. If you change this configuration file, the changes do not take effect until you restart the Samba daemon with the command service smb restart.

To specify the Windows workgroup and a brief description of the Samba server, edit the following lines in your smb.conf file:

workgroup = WORKGROUPNAME
server string = BRIEF COMMENT ABOUT SERVER

Replace WORKGROUPNAME with the name of the Windows workgroup to which this machine should belong. The BRIEF COMMENT ABOUT SERVER is optional and is used as the Windows comment about the Samba system.

To create a Samba share directory on your Linux system, add the following section to your smb.conf file (after modifying it to reflect your needs and your system):

[senthil]

comment = Insert a comment here

path = /home/share/

valid users = root

public = no

writable = yes

printable = no

create mask = 0765

The above example allows the users root to read and write to the directory /home/share, on the Samba server, from a Samba client.

How To Delete Users From Your Samba Domain

Deleting users from your Samba domain is a two stage process in which you have to remove the user from the Linux server and also remove the user’s corresponding smbpasswd entry. Here’s how:

1. Delete the users using the smbpasswd with the -x switch

[root@bigboy tmp]# smbpasswd -x john
Deleted user john.
[root@bigboy root]#

2. Delete The Linux User by following the normal deletion process. For example, to delete the user john and all john’s files from the Linux server use:

[root@bigboy tmp]# userdel -r john

Sometimes you may not want to delete the user’s files so that they can be accessed by other users at some other time. In this case you can just deactivate the user’s account using the passwd -l username command.

Conclusion

By now you should have a fairly good understanding of adding users and PCs to a Samba domain

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s