unit - iii. installing samba windows uses sever message block(smb) to communicate with each other...

28
UNIT - III

Upload: holly-payne

Post on 24-Dec-2015

227 views

Category:

Documents


2 download

TRANSCRIPT

UNIT - III

Installing Samba• Windows uses Sever Message Block(SMB) to

communicate with each other using sharing services like file and printer.

• Samba makes icon of Linux computer to appear in Windows Network Places and files of Linux is made to be easily browsed by Windows Explorer.

• RHEL includes three samba packages :• 1. samba• 2. sambaclient• 3. samba-common• They are either installed during installation or they may be

not.• To verify use the command :• [root#] rpmquery –qa| grep samba

• If it is not installed the command will return samba is not installed and if it is installed RPM query returns the version number of the samba program installed.

To install • 1. download the latest version from Samba website :

samba.org• 2. install it :• [root#] rpm –i samba(name of file)

where name of the file is the version number of file downloaded.

• 3. Download samba-common and sambaclient or else download zipped rpm version (samba-latest.tar.gz)

• Extract using following command• [root#] tar –xfvz samba-latest.tar.gz

• 4. change directory and use configure• [root#] cd /urs/src• [root#] ./configure• 5. execute :• [root#]make• [root#]make install• Samba is installed when command prompt returns.

Configuring Samba Server• Samba is needed to be configured before it connects to

Window PC.• Samba configuration file is smb.conf and it is located in

/etc/samba directory.• smb.conf is divided into several sections called shares.• Names of these sections are written in square brackets.

Global section in smb.conf• [global]• workgroup = TYIT• netbios name = Red Hat Linux• server string = Samba Server • security = SHARE• log file = /var/log/samba/log • smb passwd file =/etc/samba/smbpasswd• max log size = 50• dns proxy = No• encrypt passwords= Yes• load printers = yes

Explanation of global section• workgroup = TYIT is the name of the workgroup shown

in the identification tab of the network properties box on the Windows computer.

• netbios name = Red Hat Linux is the name by which the Samba server is known to the Windows computer.

• server string = Samba Server is the name of the Samba server.

•  log file = /var/log/samba/log is the location of the log file.

• max log size = 50 is the maximum size in kilobytes that the file can grow to.

• security = SHARE is the level of security applied to server access. Other possible options are user, the default setting; domain; and server.

• Using share makes it easier to create anonymous shares that do not require authentication, and it is useful when the netbios names of the Windows computers are different from other names on the Linux computer.

• Server is used if the password file is on another server in the network. Domain is used if the clients are added to a Windows NT domain using smbpasswd, and login requests are by a Windows NT primary or backup domain controller.

• dns proxy = No indicates that the netbios name will not be treated like a DNS name and there is no DNS lookup.

• encrypt passwords = yes while connecting to windows passwords will be encrypted.

Homes section in smb.conf• [homes]• comment = Home Directories• read only = No• writeable = yes• create mode = 0664• directory mode=0775• browseable = yes• max connections = 1

Explanation of home section• comment = Home Directories is a comment line• read only = No specifies that users can write to their

directories.• browseable = yes makes home directory browseable in

Windows browser.• create mode = 0664 sets read,write and execute

permissions for created directories.

•  

• directory mode= 0775 sets default read, write and execute permissions for created directories.

• max connections = 1 specifies number of simultaneous login. Setting 1 allows user to login only at one location. Setting 2 allows user to login from two locations and so on. Setting 0 will allow unlimited number of connections.

Printer section in smb.conf• comment = All Printers• path = /var/spool/samba • guest ok = Yes• print ok = Yes• browseable = Yes

Explanation of printer section• path = /var/spool/samba is the location of the printer

spool directory.• guest ok = Yes enables guest access to the printer.• print ok = Yes enables clients to send print jobs to the

specified directory.• This option must be set or printing does not work.• browseable = Yes means that the printer appears in the

browse list.•

 

• To check whether smb.conf is properly configured following command is used :

• [root#] testparm• Loaded services file OK.

Creating Samba Users• Samba users are created as any ordinary users but the

passwords are given using smbpasswd command :• [root#] useradd john• [root#] smbpasswd –a john• New SMB password :• Retype new SMB password:• Password changed for user john.

• To convert all of the system users to samba users :• [root#] cat /etc/passwd | mksmbpasswd.sh >

/etc/samba/smbpasswd• The above command creates only the users accounts not

their passwords.• Passwords for users is allotted individually by using the

smbpasswd command and their user’s name.

Starting the Samba Server• To start the samba daemon following are the steps :• 1. to start the samba daemon• [root#] service smb start• Starting SMB services :[OK]• The above command runs provided samba server is

configured.• It is configured to allow users who have accounts on

RHEL system to access their home directories from a Window PC.

• Logged-in users are also able to use the printers configured with the Red Hat system.

• 2. enable samba at system boot• [root#] chkconfig smb on

Connecting to Samba Client• One can easily connect the system to any computer that

is running the SMB protocol.• The connection can be made using two methods .• 1. using smbclient command• 2. using smbmount command

smbclient command• # smbclient //computername/sharename• [root#] smbclient //MY_PC/C• Password :• Domain = [TYIT] OS=[Windows 5.0] • Server =[Windows 2000 LAN Manager]• smb:\>• Where MY-PC is the name of windows machine. Instead

of hostname , IP address can also be specified.

• This example shows logging into Windows PC from Red Hat system.

• Password was prompted to log in and it gave some information about windows system and a command prompt.

• This prompt is called as samba prompt.

smbmount command • #smbmount //computer-name/sharename/mount point• [root#] smbmount //MY_PC/C/tyit• Password:• Where tyit is the directory on Red Hat Linux system to be

mounted.• After entering the password for windows machine ,

directory is changed to mounted directory.• [root#] cd /tyit• [root#] ls

• Users can now easily move and open the files between two systems using regular file system utilities.

• There is a hidden file .sambafile which is created which has the username and password.

• To unmount the client file system, enter the smbunmount command :

• [root#] smunmount /tyit

Connecting from a windows PC to Samba Server

• 1. for systems running windows 2000 or xp , no configuration is required.

• On windows computer, double-click the My Network Places icon from the Desktop.

• 2. In the Network Places window , you should now see a listing for the Red Hat computer for eg;rhl10.

• Double click the rhl10 icon and the shares will be available.

• 3. a username and password will be prompted to enter the directories.

• Now sharing is available between Linux and Windows computers.