Linux Learning Note 14: Installing Samba (Server Message Block)

Source: Internet
Author: User
Tags create directory

NFS: For Linux only

CIFS: Used only between Windows

SAMBA: Can be used between Linux and Windows , based on NetBIOS protocol ( for Intra -LAN, not across routes) , there is no concept of IP address, according to

NetBIOSname to differentiate the host.

Two + services:

NMBD:UDP 137,138, Management workgroup,NetBios name, and so on.

Smbd:tcp 's 139, Managing shared Directories, files, printers, and more.

two modes:Peer/peer (workgroup, Peer mode ), domain (domains, master mode )

1, install samba,samba-client,Samba-common These three software:

Yuminstall Samba (Samba-common installed automatically )

Yuminstall samba-client

2, modify the configuration file /etc/samba/smb.conf , and Testpara check the correctness.

Modify:

[Global]

Workgroup = Workgroup

Security = User

Add the following subsections:

[Share]

Comment = Samba on 204

Path =/home/share

browseable= Yes

writable = yes

Write list = @users

3. Common script Files

/USR/SBIN{SMBD,NMBD} Server features

/usr/bin/{tdbdump,tdbtool} view, manipulate user password database

/usr/bin/smbstatus Show current online status

/usr/bin/pdbedit managing Samba user accounts

/usr/bin/testparm verifying The correctness of the configuration file smb.conf

/sbin/mount.cifs(requires yum install cifs* installation)

/usr/bin/smbclient Client

/usr/bin/nmblookup Find NetBios name

/usr/bin/smbtree displaying the directory tree

4.Create user Luguohua to belong to the users group

Usermod-g Users Luguohua

5. Create Directory /home/share

[Email protected]_centos7_204home] #chgrp Users/home/share

[Email protected]_centos7_204home]# chmod 2770/home/share

[Email protected]_centos7_204home]# ll-d/home/share

DRWXRWS---. 2 Root users 6 Mar 23:28/home/share

6.Add Samba user Luguohuaand set the password.

Pdbedit-a-U Luguohua

Pdbedit-l

7. Modify the security settings

getsebool-a | grep Samba

Setsebool-p Samba_enable_home_dirs=1

Setsebool-p samba_export_all_rw=1

Shutting down the firewall

Iptables-f

8. Restart Samba

/etc/init.d/smbrestart

/etc/init.d/nmbrestart

Or

SERVICESMB start

SERVICENMB start

Or

Smbd-d

Nmbd-d

9. Testing

(1) enter command at command line: smbclient-l//127.0.0.1-u Luguohua

If you enter your password as required, you are prompted with an error:

Session setup Failed:nt_status_logon_failure

This is because the user who executes the smbclient command Luguohua does not become a user of the Samba service, the workaround is as follows:

Add user Luguohua to Samba first

~$ smbpasswd-a a user ID

Set a password as required

(2) Make sure the mount.cifs is installed (yum install cifs*) and mount as follows.

Mount-tcifs-o Username=luguohua//127.0.0.1/share/mnt

Mount-tcifs-o Username=luguohua//192.168.1.204/share/mnt

(3) in the Windows when you test in a \\192.168.1.204\share , be sure to note the direction of the slash and Linux is not the same.


Linux Learning Note 14: Installing Samba (Server Message Block)

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.