Linux and Windows share resources through samba

Source: Internet
Author: User
Tags windows 5
& Nbsp; there is a lot of information about samba on the Internet, but the online information tends to be set up on enterprise-level servers. The simplest and most basic access between personal PCs is rarely written, and the wide range of network information is also confusing. generally, experts prefer to write too simple documents. I will record the simplest configuration for parameters only  

There is a lot of information about samba on the Internet, but the online information tends to be set up on enterprise-level servers. The simplest and most basic access between personal PCs is rarely written, and the wide range of network information is also confusing. generally, experts prefer to write too simple documents. I will record the simplest configuration for your reference only.

I. purpose:

1. access windows shared files in linux

2. ACCESS linux shared files in windows (user mode-user name and password required)

Simple description:

You only need to configure the samba service on the linux server to access each other.

Windows accesses linux through network neighbors, which is no different from accessing windows hosts.

Linux uses the mount tool to mount shared files on remote windows to a local directory.

II. operating system version:

1. windows machine -- windowsxp sp2

2. linux machine -- Fedora8

III. samba configuration

Suppose we have installed the samba software package. No rpm package can be downloaded or installed through yum. The key to samba configuration is to edit/etc/samba/smb. conf and configure/etc/samba/lmhost.

According to the security mode, we only configure two samba configurations;

Share mode-anonymous mode. you can access shared resources without the user name or password.

User method -- user name and password required for access

1. share mode

This method is relatively simple, but not secure, and accessible to everyone on the network.

1) configure/etc/samba/lmhosts

Content: ip netbios

2) configuration document:/etc/samba/smb. conf:

[Global]

Netbios = sambaserver # this parameter indicates the samba host, which is different from the host name.

Security = share # specify the access method

Server string = samba server # host description

Workgroup = workgroup # Working Group of the windows host

# File to be shared

[Test] # this can be written at will

Path =/test1

Browseable = yes # Can I access the data in a browser. Http access allowed

Writable = yes # whether to write

Guest OK = yes # customer access

2. user mode

1) configure lmhosts in the same share mode

2) add a samba user

This samba user refers to the user used to log on to the samba host, which is set on the samba host.

Note: This samba user must first be a linux system user. it is easy to understand that you are only a linux system user and can log on to the linux host to access the samba service, in fact, it is also an access to the linux host.

A. First, add a linux user. the root user is root. you can use the root user or add a new user. Add new user dudu

B. add a samba user.

Run the command: smbpasswd-a dudu # and enter the password. this password is used to log on to samba.

C. configure smb. conf:

# Host parameters

[Global]

# Host name-related parameters

Workgroup = WORKGROUP

Netbios name = ergo_haier

Server string = ergos haier notebook

# Logon logs

Log file =/var/log/samba/% m. log

Max log size = 50

# Security authentication method

Security = user

# Encrypt passwords

Encrypt passwords = yes

Smb passwd file =/etc/samba/smbpasswd

# All samba user information

Username map =/etc/samba/smbusers

# Define which machines can access or reject

Hosts allow = 10.153.11.xx

# The above can be the network segment, 10.153.11. this represents the network segment 10.153.11.0-255.

# It can also be multiple CIDR blocks

# The following are the directory settings you want to share

[Haierdoc]

Comment = Haier doc

Path =/doc

Browseable = yes

Writable = yes

Valid users = dudu

D. check the configuration.

Run testparm.

After the command is executed, press enter to list all your configurations for easy observation.

After the configuration is complete, restart/etc/init. d/smb restart

4. mutual access between linux and windows

1. ACCESS linux in windows

This is relatively simple. it can be done through a network neighbor. it is the same as accessing a host in a workgroup.

2. access windows in linux

If windows has a shared directory, we need to mount the shared directory on the remote host to the local directory through the mount command:

1) view the shared directory of the remote host

Smbclient-L remote host IP address-U windows_user_name # Note-U is followed by the windows user name

Enter the password to display the shared directory:

[Root @ ErgoN samba] # smbclient-L 10.153.11.1xx-U xx

Password:

Domain = [92D68C913D67417] OS = [Windows 5.1] Server = [Windows 2000 LAN Manager]

Sharename Type Comment

--------------------

G (G) Disk

Centos5.1 Disk

IPC $ IPC remote IPC

Session request to 10.153.11.142 failed (Called name not present)

Session request to 10 failed (Called name not present)

Domain = [92D68C913D67417] OS = [Windows 5.1] Server = [Windows 2000 LAN Manager]

Server Comment

----------------

Workgroup Master

----------------

2) Mount remote resources

Mount. cifs // 10.153.11.1xx/centos5.1/mnt-o user = xxx

NOTE: Many articles on the Internet use smb

Related Article

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.