Samba installation Test details

Source: Internet
Author: User
Samba installation test details samba-clienti386samba-commoni386sambai386samba-swati3861, installation package yuminstallsamba *-y configuration directory etcsambamansmbconfvimetcsambasmbconf [global] Samba installation test details samba-client.i386samba-common.i386samba.i386samba-swat.i386 1. installation package # yum install samba *-y configuration directory/etc/samba man smb. conf # vim/etc/samba/smb. conf [global] workgroup = MYGROUP server string = Samba Server Version % v security = user passdb backend = t Dbsam load printers = yes cups options = raw [homes] comment = Home Directories browseable = no writable = yes [printers] comment = All Printers path =/var/spool/samba browseable = no guest OK = no # <--- yes anonymous access, no rejects anonymous access to writable = no # <--- yes resources can be written, no read-only printable = yes [share] comment = This is rhce testingpath =/commonbrowseable = yes # <--- make the resource visible hosts allow = .example.com # <--- only example is allowed. co User access to valid users = user1 # <--- This resource is only valid for user1, other users cannot access writable = yes # <-- resource writable 2. create a directory and modify the selinux context # mkdir/common # chmod 775/common # chcon-R-t samba_assist_t/common # setsebool -P samba_export_all_ro on or # setsebool-P samba_export_all_rw on 3. create an independent samba account. note: these accounts must be owned by the system itself [useradd user1] # smbpasswd -- help # smbpasswd-a user1 <--- add user1 to the account data file dedicated to smb 4. set iptablessamber there are two processes: nmbd 1 37,138 smbd 139,445 iptables-I INPUT-m state -- state ESTABLISHED, RELATED-j ACCEPTiptables-a input-I lo-j ACCEPTiptables-A INPUT-p tcp-m multiport -- dports 137,138,139,445-j ACCEPTiptables-A INPUT-p udp-m multiport -- dports 137,138,139,445 -j ACCEPT5, test # service smb restart # smbclient-L // 192.168.0.249-U user1 <-- list accessible resources # smbclient/192.168.0.249/share-U user1 <-- Access name share Resources If the shared directory is a public directory, that is, the directory is shared by other services, selinux context is set as follows: # chcon-t public_content_t/common # chcon-t public_content_rw_t/common/pub summary: if the/common directory is nfs, vsftp, samba shares selinux settings at the same time: if you require write permission on this directory: chcon-R-t public_content_rw_t/common if read-only: chcon-R-t public_content_t/common file system permission: if you require write permission on this directory: chmod 775/commonchown root: XXXX/common "-- XXXX indicates that the iptables setting (samba, nfs, ftp) of the user's group is written in this directory through samba: modprobe ip_c Onntrack_ftp <--- echo "modprobe ip_conntrack_ftp">/erc/rc. d/rc. local iptables-I input-m state -- state ESTABLISHED, RELATED-j ACCEPTiptables-a input-I lo-j ACCEPTiptables-A INPUT-p tcp-m multiport -- dports 20, 21, 137,138,139,445,875,328 892,662,202, 32769, 2049,-j ACCEPT iptables-p input drop exercise: 1. using samba to share the/common Directory requires that all users in the t113.org domain not be allowed to access it. Only user2 is allowed to access this resource [share] comment = "test" path =/commonhosts deny =. t113.orgvalid users = user2 useradd user2smbpasswd-a user2, access the user's home directory resources through smbclient, test whether Upload and other operations are supported. find the selinux Boolean value setting getsebool command related to the samba home directory. # getsebool-a | grep sambasamba_domain_controller --> disable --> off ----- samba_export_all_ro --> offsamba_export_all_rw --> onsamba_assist_nfs --> offuse_samba_home_dirs --> o Ff ----- pai_use_samba --> off setsebool-P samba_enable_home_dirs = 1 setsebool-P use_samba_home_dirs = 1 3. the samba shared/share directory allows everyone to access and anonymous access, you can upload files anonymously. [Pub] comment = "Public source" path =/shareguest OK = yesbrowseable = yeswritable = yes # chcon-t public_content_rw_t/share/You must also set directory permissions and selinux policy chmod 777/sharesetsebool -P allow_smbd_anon_write = 1 test # smbclient-L // 192.168.0.249 # smbclient // 192.168.0.249

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.