Samba Service Configuration text

Source: Internet
Author: User

Create a simple Samba server

Samba is rarely used on the internet/mostly for LAN Web page updates/

First see if you've installed the samba, RPM-QA | grep Samba

Introduction to Samba 1) location of samba files/etc/samba/smb.conf

2 The two daemons of samba:--SMBD (primary) listens to the role of the 139TCP port process responsible for user authentication and file sharing

--NMBD listens to the 137 and 138UDP processes for processing browser sharing and computer name resolution

3 Open Samba Service #/etc/rc.d/init.d/smb start

#对于一些比较重要的文件先备份在修改

4 Samba Four settings segment: "Global" set Global environment Option "homes" set User host directory Share "printers" Set print Share "sharefile" settings File share Samba has two annotation characters ";", "#"

#grep-V "^#"/etc/samba/smb.conf does not look at the beginning of the # number line

4.1 "Global" segment main options workgroup= specifies that a workgroup or domain can write a domain name or host name, and how to write it all line service string= description

security= Specified Safe Mode 1.share window Access Linux does not require password no permissions to verify 2.user default recommended, verified by Linux Samba server 3.server third party host authentication

4.domain Third party host authentication (third party must be window domain Controller) hosts allow = Qualified host access

Service Basic Qualification 1, those hosts can access the hosts allow =127. 192.168.9. <-format hosts deny 2, which users can access

Log file= Specifies the location of the logging file Max log size= Specify the size of the log

"Homes"

Commend description

Browseable=no directory hide without permission access

Writable=yes can write no read-only each user has write access to their own host directory

Examples of application of Samba

If SELinux is enabled for installation, it needs to be performed; You can see your host without access, and you can perform the following;

View Path #gesebool-a| grep Samba #stesebool-P samba_enable_home_dirs on

The general system has two firewalls netfilter/iptables #ipyables-F SElinux Kernel firewall

To turn off the permanent SELINUX feature edit # vi/etc/selinxu/connfig selinux=disabled OK

URL Address: http://www.bianceng.cn/Servers/zs/201602/49628.htm

Set Samba password smbpasswd-a username Modify password can omit-a

#/etc/rc.d/init.d/smb Start #ps-le | grep SMB

#pgrep NMBD ~ ~ SMBD Access Samba "Start"--"Run"

, enter the address of the \\samba server to view client information on the Samba server side #smbstatus

The first time not to go in, the second log off or under restart or in the native run cmd input net use */delete/y disconnect all sessions

View Connection net use

Remove Samba User

Smbpasswd-x User Name

Extended #getsebool-a|grep Samba #查看ftp相关写权限是否打开 #setsebool-P * * * * * * * #使某选项生效

Samba Application Real Column

Samba shared directory/software, allowing the user Jack Mary to access through the window client and have read and write permissions

1, first to create the software directory #mkdir/software add two users Jack Mary #useradd Jack #useradd Mary #passwd Jack #passwd Mary

If the SELinux is installed first, the/software directory will be shared out to other users, and the following command #chcon-t Samba_share_t/software

Configure the service at the end of the samba file

# vi/etc/samba/smb.conf

"Software" share name must not have special symbols

Path=/software Shared directories can only be shared with a directory valid Users=jack Mary

Specify a valid Access user Writable=yes permission

Set user Jack Mary's Samba password boot Samba service/ETC/RC.D/INIT.D/SMB restart

We'll find that we can't create files obviously we've given Samba permission to write.

1 whether Samba grants Write permission 2) whether the user has write permission on the shared directory in the Linux system the two intersect to achieve write permission

# Groupadd Softadmin #gpasswd-a jack Softadmin #gpasswd-a Mary softadmin #ls-ld/software #chgrp softadmin/software #c Hmod g+w/software #grep softadmin/etc/group jack Mary Samba Server detection command

#testparm detect the syntax errors of samba

Samba Case List Three

Create a public read-only directory/public, everyone can browse the contents of the catalog, but can not arbitrarily delete.

' Public ' comment=read only public path=/public Writable=no

Case IV establishment of departmental data sharing directory/hr. Everyone in the department can read and write. But you can't delete other people's files.

"HR" path=/hr valid users= Zhangsan Lisi Wangwu

#chmod 1777/hr is to put a bit of sticky bits on the directory 1

Extended Content ***************************

5, Samba//if you want to share files others than home Directorie < If you want to share the directory with other users, you need to set > Chcon-t Samba_share_t/di Rectory

If you are want to share files with multiple domains if the Samba server shares directories to multiple domains, you will need to: Setsebool-p allow_smbd_anon_write=1

If you are are setting up this machine as a Samba server and wish to share the home directories Samba server to share the House directory: Setsebool- P Samba_enable_home_dirs 1

If you want to use a remote samba server for the "home directories" in this machine if you need to be using a want directory on your computer setsebool-p Use_samba_home_dirs 1

You can disable SELinux protection for the samba daemon by executing turn off SELinux on Samba daemon protection setsebool-p Smbd_disable_ Trans 1 service SMB restart

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.