Simple configuration of Samba in Centos6.5, centos6.5samba

Source: Internet
Author: User

Simple configuration of Samba in Centos6.5, centos6.5samba

The purpose of this article is to describe how to configure a simple and available samba service in CentOS6.5 environment and access its files through windows.

Install related software

# yum install samba samba-client samba-commo<span class="com"># chkconfig smb on</span><span class="com"># chkconfig nmb on</span><span class="com"></span>

Perform the following operations on the route table:

# iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT# iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT# iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT# service iptables save

Backup configuration file

Back up the configuration file before formal Configuration

# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak# rm /etc/samba/smb.conf# touch /etc/samba/smb.conf# vi /etc/samba/smb.conf

Configure a public directory

Configure a public access directory in the newly created smb. add the following configuration to the conf file: <pre name = "code" class = "plain" >#==================== === Global Settings ========================================== = [global] workgroup = WORKGROUPsecurity = export map to guest = bad user #================== ===== Share Definitions ============================== [MyShare] path =/home/samba/export browsable = yeswritable = yesguest OK = yesread only = no

Set folder permissions, check configuration files, and restart services
<pre style="" class="wp-code-highlight prettyprint linenums:1 prettyprinted"><span class="com"># chmod -R 0777 /home/samba/share</span><pre style="" class="wp-code-highlight prettyprint linenums:1 prettyprinted"><span class="com"># testparm</span>
# Service smb restart # service nmb restart

 
 

 

Configure a restricted access directory

Add related operators and group configurations <pre name = "code" class = "plain"> # useradd smbuser # groupadd smbgrp # usermod-a-G smbgrp smbuser # smbpasswd-a smbuser

Create a directory that requires special users to access
    # cd /home/samba/    # mkdir secure    # chown -R arbab:smbgrp secure/    # chmod -R 0770 secure/

Add the following configuration to the configuration file:
[Secure]path = /home/samba/securevalid users = @smbgrpguest ok = nowritable = yesbrowsable = yes

Check the configuration file and restart the service.
    # testparm    # service smb restart    # service nmb restart


 

Solve the Problem of no access permission

<P> if you have no access permission, you can disable the firewall and selinux to try </p> <pre name = "code" class = "plain"> # service iptables stop # setenforce 0

 




How to change the/etc/samba/smbconf file in centos 63 to set multiple shared folders, some of which are public and some require authentication

Section 1: What does samba do? What is its use?
Samba (SMB) is a network server. It is the most important service for Linux as a local server and is used for sharing files between Linux and Windows; samba can be used for shared files between Windows and Linux, and for shared files between Linux and Linux. However, for shared files between Linux and Linux, NFS is a better network file system, NFS also requires server setup;
We all know that each machine in the Windows network can be a file sharing server or a client, and Samba can do the same, for example, a Linux machine, if the Samba Server is mounted, it can act as a shared Server, and can also be used as a client to Access Windows shared file systems in other networks, or other Linux Sabmba servers;
In Windows network, we can see the shared file function, we can directly use the shared folder as a local hard disk. In Linux, Samba is used to provide a shared file system to machines on the network. It can also be used to mount the sharing of other machines on the local machine; in a sense, this is different from FTP.
Samba should be mainly used in networks where Windows and Linux systems coexist. If a network environment is a Linux or Unix system, it is better to use NFS if Samba is not necessary;
So what services does Samba provide for us? Sharing Files and printers;
Samba includes two server daemon processes: smbd and nmbd. These two processes perform their respective duties and have different functions: smbd is the kernel of the samba service and serves as the basis for establishing conversations, verifying users, providing file systems and print services, and is responsible for sharing hard drive and printer. Users access this process through a client to share files and printers. nmbd enables network browsing, so that the samba server is displayed in a windows network neighbor and allows users to browse available resources. It manages and transmits NETBIOS information so that windows users can use "\ serverip" in Explorer to access samba shared files.

2. Installation and service operation commands
It is very easy to install the samba program. Use rpm-q samba to check whether the samba software has been installed in the current system.
If you do not have one, go to the disc and run the rpm-ivh * samba *. rpm command.
Carefully describe the installation package:
Samba-common-3.0.28-0.el5.8 // The most basic files on samba servers and clients

Samba-3.0.28-0.el5.8 // samba server core package
System-config-samba-1.2.39-1.el5 // samba graphical configuration interface
Samba-client-3.0.28-0.el5.8 // samba client software
Start, pause, and stop services:/etc/init. d/smb start
/Etc/init. d/smb stop
/Etc/init. d/smb restart
Or service smb start
Service smb stop
Service smb restart

Section 2: The simplest example is the implementation of readable and writable anonymous users.
Step 1: Change smb. conf
Let's implement a simple function so that all users can read and write a folder shared by a Samba server. We need to modify smb. conf. First, back up the smb. conf file;

[Root @ l... the remaining full text>

How to configure the SAMBA server in LINUX

On the Linux platform, install the samba server in two ways: Binary Package and source code, sort out relevant configuration files, and provide basic application operations.
Steps:
1. The samba service already exists on the machine. The version is 3.0.21b, which is obtained by running the rpm command. As follows:
# Rpm-qa | grep samba
Samba-client-3.0.21b-2
Samba-common-3.0.21b-2
2. Unload the above samba-client-3.0.21b-2. Use the command: rpm-e samba-client-3.0.21b-2.
3. Run the rpm-e samba-common-3.0.21b-2 to uninstall common, because of dependency, failed.
4. Download the Binary Package:
Samba-common-3.0.23c-4.i386.rpm,
Samba-client-3.0.23c-4.i386.rpm,
Samba-doc-3.0.23c-4.i386.rpm,
Samba-3.0.23c-4. i386.rpm.
5. install these packages. Run the following commands:
Rpm-Uvh samba-common-3.0.23c-4.i386.rpm
Rpm-ivh samba-client-3.0.23c-4.i386.rpm
Rpm-ivh samba-3.0.23c-4.i386.rpm
Rpm-ivh samba-doc-3.0.23c-4.i386.rpm
Use the Uvh option to install common because the original common is not uninstalled, so you should upgrade and install (U ).
6. Use rpm-qa samba to confirm the installation. The samba-3.0.24c-4 is output.
7. Configure the samba service.
8. First, modify the/etc/samba/lmhosts file. Add a line to the IP address and Host Name of the Windows system on this machine. In this way, you can access the Unix samba service through Windows.
9. Create/export/sambadir as the shared directory.
Command: mkdir-p/export/sambadir
Chmod 777/export/sambadir
10. Modify the/etc/samba/smb. conf file. This is the samba configuration file.
Security = user
Log file =/var/log/samba/log. % m
Path =/export/sambadir
11. Use testparam to test the Modification result.
12. Add a user and change the password.
13. Run the chkconfig command to start samba in startup Level 5. The command is as follows:
Chkconfig-list | grep smb
Chkconfig-level 5 smb on
Chkconfig-list | grep smb
14. Restart the network service:
/Etc/rc. d/init. d/cups stop
/Etc/rc. d/init. d/smb restart
15. Then, you can access Linux using the username and password set in step 12 in Windows.
16. Install the source code: Download The samba-3.0.23c.tar.gz source code package and decompress it.
Cd samba-3.0.23c/source
./Autogen. sh
./Configure-prefi ...... remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.