Learn Bird Brother Linux service-samba file sharing service

Source: Internet
Author: User


Experimental environment

CentOS 6.5

ipaddr=192.168.1.229


Yum-y Install Samba

Configuration file

Vim/etc/samba/smb.conf


[Global] Parameters

Workgroup = Workgroup #工作组

Server string = Samba server Version by Ltiaw #显示名称

NetBIOS name = Fileserver #windows工作组显示的主机名

Log file =/var/log/samba/log.%m #日志记录

Max log size = #日志大小限制 0 means no Limit


Security = User #认证模式user authentication, share sharing not certified

Passdb backend = Tdbsam #用户密码数据


Create a Directory

[Shared directory] #目录名称

Comment = Sharedir #描述

Path =/company/gshare #路径

browseable = yes #是否允许浏览 =yes

Public = yes #是否共公 =yes

writable = yes #可写? =yes

Create mask = 0755 #文件创建的默认权限

Directory mask = 0755 #目录创建的默认权限

Save exit

Start the service

/ETC/INIT.D/SMB restart

Open ports:

udp137

udp138

tcp139

tcp445

Iptables-i input-p UDP--dport 137:138-j ACCEPT

Iptables-i input-p TCP--dport 139-j ACCEPT

Iptables-i input-p TCP--dport 445-j ACCEPT


Create user

[Email protected] ~]# useradd-s/sbin/nologin Bob #创建bob不允许登录

[Email protected] ~]# pdbedit-a Bob #用pdbedit命令创建smb用户

New Password:

Retype new Password:

Unix Username:bob

NT Username:

Account Flags: [U]

User sid:s-1-5-21-2341977322-3935453642-2240024245-1001

Primary Group sid:s-1-5-21-2341977322-3935453642-2240024245-513

Full Name:

Home Directory: \\fileserver\bob

Homedir Drive:

Logon Script:

Profile Path: \\fileserver\bob\profile

Domain:fileserver

Account desc:

Workstations:

Munged Dial:

Logon time:0

Logoff time: Three, 06 February 2036 23:06:39 CST

Kickoff time: Three, 06 February 2036 23:06:39 CST

Password last set: Three, 30 March 10:45:31 CST

Password can change: three, 30 March 10:45:31 CST

Password must Change:never

Last Bad password:0

Bad password count:0

Logon HOURS:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF


To create a directory:

Mkdir-p/company/gshare/

View Permissions

Ll/company/gshare/

Drwxr-xr-x. 2 root root 4096 March 10:41 Gshare

chmod o+w/company/gshare/#这个是共用目录所有把其它人的权限加上w


############### #测试 ##########################

Access Share on Windows

\\192.168.1.229

Prompt cannot access, no permission

Could be a problem with SELinux.

ll-dz/company/#查看目录selinux文

Change

Chcon-r-T Samba_share_t/company/gshare/

Access

\\192.168.1.229

Access successfully entered user password login

I see a shared directory.

Create Delete Write

The basic samba Setup was successful.

Join boot Start

Chkconfig SMB on

Chkconfig NMB on #能让工作组里查找到samba的服务


################# #其他功能 ###############################

1. If you want to enter the share without entering the password, allow the user to operate

[Global]

Security = Share #改为share

Save restart

/ETC/INIT.D/SMB restart

\\192.168.1.229

Successful access

New file: 1.txt

On the server ll 1.txt view. Discover that the 1.txt owner and group are mapped to: nobody

/company/gshare permissions have just lifted the O privilege to 7, so the operation is no problem!


2. Allow the user to operate and also set the access to other folders to verify!

[Global]

Security = User #启用验证

Passdb backend = Tdbsam

Map to Guest = Bad user #增加这两行, allowing zone names to operate in user mode

Guest account = Nobody #设置區名用nobody


Defining folders

[Bob]

Comment = Bob

Path =/company/bob

browseable = yes

public = no #不公用

writable = no #不能写

Write list = Bob #写用户列表

Admin user = Bob #拥有者

Saving overloaded Services

/ETC/INIT.D/SMB Reload


Create a folder

mkdir/company/bob/

Change owner

Chown Bob.bob Bob


Windows access \\192.168.1.229

Open to see the shared directory and Bob, be able to enter the shared directory, dot Bob prompts to enter the password. Success

Specific permissions can be set by themselves


3. Create a Recycle Bin for Samba


[Bob]

Comment = Bob

Path =/company/bob

browseable = yes

public = No

writable = no

Write list = Bob

Admin user = Bob

VFS Object = Recycle #启用回收站模块

Recycle:repository = Recycle Bin/#目录名

Recycle:keeptree = yes #保持文件目录树

Recycle:versions = yes #当同名时, with copy #1 of difference

Recycle:maxsixe = 0 #无限大小

Recycle:exclude = *.tmp,*. tmp,~$* #例外文件, not saved to recycle Bin

Delete 1.txt under Bob, automatically generate the Recycle Bin directory, and 1.txt is already in the directory,

Test success


4.samba does not load the printer's settings

Even if the use of the success, but Cat/var/log/message still found the following error. It's about the printer.


[2016/03/30 10:06:17.767580, 0] printing/print_cups.c:151 (cups_connect)

Mar 10:06:17 Yscoo smbd[15046]: Unable to connect to CUPS server localhost:631-Deny connection

Mar 10:06:17 Yscoo smbd[26784]: [2016/03/30 10:06:17.768023, 0] printing/print_cups.c:528 (cups_async_callback)

Mar 10:06:17 Yscoo smbd[26784]: Failed to retrieve printer list:nt_status_unsuccessful


Modify print settings


Load printers = No

; Cups options = raw #注释这行

Printcap name =/dev/null

printing = Cups

Disable SPOOLSS = yes #不显示打印机


Save

/ETC/INIT.D/SMB Reload

View the log without prompting for errors

Printers and Faxes are not visible in Windows access











Learn Bird Brother Linux service-samba file sharing service

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.