Simple configuration of Samba server in Linux

Source: Internet
Author: User

Simple configuration of Samba server in Linux

Take Red Hat Enterprise Linux as an example to briefly introduce the configuration of Samba Server

1. Configure the Samba server, mainly to set the configuration file/etc/samba/smb. conf

A simple configuration file is as follows:

[Global]

Workgroup = workgroup # Add the Samba server to the workgroup

NetBIOS name = rehl5 # You can see it on the Windows network.

Server String = Samba server version % v # Samba server description

Security = share # Security Mode

[Docs]

Comment = share documents # description of shared documents

Path =/usr/share/doc # shared directory

Public = yes # Anonymous Access Allowed

After setting smb. conf

# Service SMB restart SAMBA service,

You can see this machine in the Windows Network Neighbor.

If you double-click the icon of this machine and cannot open it, it indicates that there is a firewall, you can use

# Iptables-F temporarily clear firewall settings

How to open some ports in the firewall and use iptables remains to be studied.

If the configured directory permission is insufficient, you can use

# Chmod 777/localdir change Directory Permissions

If you still cannot access it, the following error occurs: "You may not have the permission to use network resources ",


That's what SELinux is doing.

To make the shared directory accessible, run the following command:

# Setenforce 0

Temporarily stop SELinux

Use

# Setenforce 1

Enable SELinux

What is SELinux? How to improve security remains to be studied! * ***** (This problem took me half a day !)

Completely disable SELinux(2008-6-1)
Edit/etc/sysconfig/SELinux
Change the first option to disabled (see figure)

2. samba client Tool

(1) smbtree

Purpose: display the list of all shared hosts and directories on the LAN.

Usage:

# Smbtree [-B] [-D] [-u username % Password]

(2) nmblookup

Purpose: display the NetBIOS Host Name of a host.

Example: # nmblookup netbios_name

(3) smbclient

Purpose: Display/log on to the shared folder in the LAN

Usage: # smbclient-l host

# Smbclient // host/share

(4) smbtar

Purpose: remotely Back Up Files of network neighbors

Usage: # smbtar-S server-u user-P password-x sharename-T output

Example: # smbtar-s Win2000-u RedHat-P RedHat-x lab-T lab.tar

3. Access Network neighbors in Linux

(1) samba client software is required

(2) mounting method used

# Mount-T smbfs // server // sharename/localdir or

# Smbmount // server/sharename/localdir

(3) Use smbclient

# Smbclient // server/sharename-u name % passwd

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.