Академический Документы
Профессиональный Документы
Культура Документы
Samba
Samba and Samba Client
Samba allows both CentOS resources to be shared with Windows systems and Windows resources to be
shared with CentOS systems. CentOS accesses Windows resources using a package named samba-client.
CentOS resources, on the other hand, are shared with Windows systems using a package named samba.
Typically, the samba-client is installed and configured by default allowing the user to browse available Windows
resources without any additional work (this is covered later in the chapter). In order to allow a CentOS 6 system
to share resources with Windows systems, however, some more work is required.
In releases of CentOS prior to version 6, a user friendly graphical tool named system-config-samba was
provided to assist in the configuration of Samba. In CentOS 6, however, this tool has been removed. This means
that the Samba environment must be configured manually within the /etc/samba/smb.conf file and using the
smbpasswd command line tool. Whilst the loss of system-config-samba may be mourned by those who relied on
it, the tools simplicity actually masked many of the more advanced features of Samba. In practice, much more
can be achieved by taking the time to understand the intricacies of the smb.conf file.
Samba is a highly flexible and configurable system that provides many different options for controlling how
resources are shared on Windows networks. This flexibility can lead to the sense that Samba is overly complex
to work with. In reality, however, many of the configuration options are not needed by the typical installation, and
the learning curve to set up a basic configuration is actually quite short.
For the purposes of this chapter we will look at joining a CentOS 6 system to a Windows workgroup and setting
up a directory as a shared resource that can be accessed by a specific user.
The first step, therefore, is to gain root privileges and to load the /etc/samba/smb.conf file into a suitable editor,
for example:
su
gedit /etc/samba/smb.conf
Begin by changing this to the actual name of the workgroup. For example, if the workgroup is named
WORKGROUP (the default for most Windows networks):
workgroup = workgroup
Double clicking on the CentOS 6 host will prompt for the name and password of a user with access privileges. In
this case it is the demo account that we configured using the smbpasswd tool. Entering the username and
password will result in the shared resources configured for that user appearing the explorer window, including
the tmp resource previously configured:
Double clicking on the tmp shared resource will display a listing of the files and directories contained therein.
To obtain a list of Windows workgroups on the network, double click on the Windows Network icon. From within
the list of workgroups double click on the desired group to obtain a listing of servers available for access:
Finally, double clicking on a computer will list the shared resources available for access from the CentOS client.
Summary
In this chapter we have looked at the steps necessary to configure a CentOS 6 system to act as both a Samba
client and server allowing the sharing of resources with other systems on a Windows based network. In the case
of Samba server configuration in particular we have only scratched the surface of the configuration options
available. A full over of Samba would require an entire book. Many such publications and online resources are
available if you would like to learn more. Another good place to start is to type man samba in a terminal window.
Samba installation :
After installing Centos 6 (Centos 6 installation step by step screenshots ) and configuring
network (How to setup network in centos 6)
Step 1 Update yum repositories and packages by typing the below command
[root@localhost ~]# yum update
Samba configuration :
Now create samba password for username shareuser using smbpasswd command .
[root@localhost ~]# smbpasswd -a shareuser
New SMB password:****
Retype new SMB password:****
Added user shareuser.
Step 5 open the file /etc/samba/smb.conf . ( Before editing the file , please copy the
file to another location for backup ) . Add the below lines at the bottom of the file .
[share]
comment = Share
path = /share
writable = yes
valid users = shareuser
and type this below command to start samba service automatically while booting.
[root@localhost ~]# chkconfig --levels 235 smb on
Samba testing :
You can see your share sections. Here by default home folders of users will be displayed .
you can comment the unwanted section using ; symbol .
For example . you can comment homes section as below and restart the service using
service smb restart
;[homes]
;comment = Home Directories
;read only = No
;browseable = No
Now you can access share folder on windows machine by typing \\samba-server-ip\ on run
prompt . you can see your share folder after entering username and password.
Cheers ..
-------------------------------
I'm using Cent OS 5.3 as the lab server. FTP is not so easy to use, so I
decide to set up Samba service.
STEP 1
Install the samba from YUM update.
view plaincopy to clipboardprint?
STEP 2
Edit the configure file
view plaincopy to clipboardprint?
1.
2.
3.
4.
5.
[global]
dos charset = GB2312
unix charset = GB2312
display charset = GB2312
directory mask = 0777
6.
7.
8.
9.
10.
11.
12.
2nd Place
Change the following line
1. workgroup = MYGROUP
into
1. workgroup = WORKGROUP
[public]
comment = Public Stuff
path = /data/public_dir
public = yes
writable = yes
STEP 3
Set up the public folder and provide sufficient privilege.
view plaincopy to clipboardprint?
STEP 4
Add samba users (Make sure that the user you are adding has already been a
linux system user). Here I take user goodcjwas an example.
view plaincopy to clipboardprint?
STEP 5
Take care of your firewall. You should configure your iptables to open port
139 and 445.
STEP 6
Make Samba suns once the system starts up.
view plaincopy to clipboardprint?
STEP 7
Now, all works are done. Use one windows PC to map the shared folder
provided by Samba.
------------------
2.set the samba work group name according to windows work group or domain name.
#nano /etc/samba/smb.conf
Press CTRL + W
Search >>>> mygroup
delete the mygroup and type your windows work group or domain name
7.Once you add a user to samba his home folder will be automatically shared. How to share a different
folder through samba.
#cd /
#mkdir test
12.Although we give a writable samba permissions, normal samba users wont be able to witting to the
folder though windows, unless we change the ext3 file folder permissions properly.