Full configuration operation of Samba server in Linux

Source: Internet
Author: User

1.Configure anonymous access to samba shared files.

2.Configure users to access Samba shared files in an authenticated manner .

3 . Set the access address limit in Samba's master profile.

4.Configure Linux to Access Other people's shared files for Samba clients.

first introduce the experimental environment: Open two virtual machines, linux-1 as a samba shared server,win 7-1 uses it as a client to access shared files on the server, and to have write access.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4A/wKioL1V4Xf6CSI0IAADedVY9K2E664.jpg "style=" float: none; "title=" Image 1.png "alt=" Wkiol1v4xf6csi0iaadedvy9k2e664.jpg "/>

the first is to mount the disc file and then use the rpm command installs as a Samba server-side installation package.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4E/wKiom1V4XFihKxGIAAQlqwNyPsE110.jpg "style=" float: none; "title=" Image 2.png "alt=" Wkiom1v4xfihkxgiaaqlqwnypse110.jpg "/>

at this point, you can first close IPtables Firewall service, and SElinux policy.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4A/wKioL1V4Xf6wAoL_AAFPtc7Soyo142.jpg "style=" float: none; "title=" Image 3.png "alt=" Wkiol1v4xf6waol_aafptc7soyo142.jpg "/>

after the installation is complete, you can use RPM-QC Samba view The installation directory for Samba services. To switch to the profile /etc/samba/ directory, the MV first modifies the main profile name, and then filters out The comment lines that begin with # and redirects them to the configuration file. You can then edit the master profile so that it's edited incorrectly and has a backup file.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4A/wKioL1V4Xf6SMv3HAAL1myMiqFk042.jpg "style=" float: none; "title=" Image 4.png "alt=" Wkiol1v4xf6smv3haal1mymiqfk042.jpg "/>

Enter Samba master configuration file, first modify Security to be share indicates that it can be accessed anonymously.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4E/wKiom1V4XFmiZnUUAABbsXAv9-w830.jpg "style=" float: none; "title=" Image 5.png "alt=" Wkiom1v4xfmiznuuaabbsxav9-w830.jpg "/>

and then press " G "Jump to Row not, add the following profile parameter. Benet is the shared file name.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4A/wKioL1V4Xf7TnpA7AAERSigm4Tw405.jpg "style=" float: none; "title=" Image 6.png "alt=" Wkiol1v4xf7tnpa7aaersigm4tw405.jpg "/>

after the configuration file setting is complete, create a shared directory in the shared path specified above. and set directory permissions. Once setup is complete, you can start the Samba sharing service.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4E/wKiom1V4XFmSNscLAAGiy327vJk135.jpg "style=" float: none; "title=" Image 7.png "alt=" Wkiom1v4xfmsnsclaagiy327vjk135.jpg "/>

Open Now Win7 virtual machine, configure the network card to ensure that the two virtual machines can be interconnected, and then enter in the run access to the IP address of the Samba server .

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4A/wKioL1V4Xf-CWyfEAAKk4a8LKQw176.jpg "style=" float: none; "title=" Image 8.png "alt=" Wkiol1v4xf-cwyfeaakk4a8lkqw176.jpg "/>

Because the permissions that can be written are set earlier, any user can write to the file in this directory.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4E/wKiom1V4XFmCg_kLAAEUIdg1iAY144.jpg "style=" float: none; "title=" Image 9.png "alt=" Wkiom1v4xfmcg_klaaeuidg1iay144.jpg "/>

Back to Linux uses the "ls-l file directory" To see the permissions of the file you just created, as well as the owner and group of Nobody, view ID The number is .

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4A/wKioL1V4Xf_zUz6iAAD_LyOMMQs077.jpg "style=" float: none; "title=" Image 10.png "alt=" Wkiol1v4xf_zuz6iaad_lyommqs077.jpg "/>

The user authentication is started below, the same must be configured first The security parameter is configured as user .

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4E/wKiom1V4XFryQqhxAABFClo0ib4696.jpg "style=" float: none; "title=" Image 11.png "alt=" Wkiom1v4xfryqqhxaabfclo0ib4696.jpg "/>

then to the row is not configured parameters of the shared file, the share name is ACCP, here you need to specify the users that valid users can allow access to.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4E/wKiom1V4XFqAbbtYAAFTArgb4ds530.jpg "style=" float: none; "title=" Image 12.png "alt=" Wkiom1v4xfqabbtyaaftargb4ds530.jpg "/>

after the configuration file configuration is complete, create the user first, and if you want to share only the suggestions do not set the user password, you can use the " smbpasswd-a username "Sets the user's samba service password, then creates the shared directory and sets permissions."

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4A/wKioL1V4XgCjaWXfAAIu0JaT590623.jpg "style=" float: none; "title=" Image 13.png "alt=" Wkiol1v4xgcjawxfaaiu0jat590623.jpg "/>

configuration completion requires a reboot at this time Samba service, notice is reboot.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4A/wKioL1V4XgDgws7HAAEIsyNwNAQ337.jpg "style=" float: none; "title=" Image 14.png "alt=" Wkiol1v4xgdgws7haaeisynwnaq337.jpg "/>

Win 7 also needs to empty the data just accessed in case there is a cache mischief.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4E/wKiom1V4XFuglnh0AALknmOCa9Y904.jpg "style=" float: none; "title=" Image 15.png "alt=" Wkiom1v4xfuglnh0aalknmoca9y904.jpg "/>

at this point, use the same IP Address, you are prompted to enter a user name and password, enter the username you just created, Zhangsan, and the samba password to access it.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4E/wKiom1V4XFuyWJBSAAOMBDN9M1I386.jpg "style=" float: none; "title=" Image 16.png "alt=" Wkiom1v4xfuywjbsaaombdn9m1i386.jpg "/>

not only can you see the shared files directory, but you can also see your home directory, and the ACCP directory can be written (in ACCP inside created a file 222.txt ).

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4A/wKioL1V4XgHC0Z1SAAJMoBGSmK8717.jpg "style=" float: none; "title=" Image 17.png "alt=" Wkiol1v4xghc0z1saajmobgsmk8717.jpg "/>

Back to in the main configuration file of the Samba server, remove the writable that represents the parameters that all users can write, and add an entry below that allows only Lisi to write.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4A/wKioL1V4XgGj2IjwAAEjS9E8yxE972.jpg "style=" float: none; "title=" Image 18.png "alt=" Wkiol1v4xggj2ijwaaejs9e8yxe972.jpg "/>

(Restart the linux Samba service, clear the cache for win 7 , and then Log in) and then use the Zhangsan User, creating a file in the ACCP directory means that no permissions have been granted.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4E/wKiom1V4XFyj1aMyAAKsRaJLAhA009.jpg "style=" float: none; "title=" Image 19.png "alt=" Wkiom1v4xfyj1amyaaksrajlaha009.jpg "/>

(Restart the samba service, empty the cache, and then log in) However, using the Lisi user login can still have write access.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4A/wKioL1V4XgKjOhjGAAJnuGkolyI731.jpg "style=" float: none; "title=" Image 20.png "alt=" Wkiol1v4xgkjohjgaajnugkolyi731.jpg "/>

Edit below /etc/samba/smbusers file, do Samba the alias mechanism of the user.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4E/wKiom1V4XF3AsPmwAACUYv99Eqo562.jpg "style=" float: none; "title=" Image 21.png "alt=" Wkiom1v4xf3aspmwaacuyv99eqo562.jpg "/>

Add the user name directly below = alias " OK .

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4A/wKioL1V4XgLiLbaSAADIvGL0ekM545.jpg "style=" float: none; "title=" Image 22.png "alt=" Wkiol1v4xglilbasaadivgl0ekm545.jpg "/>

re-edit Samba 's master configuration file, add "username map = alias path" to the global configuration to apply the alias mechanism.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/4E/wKiom1V4XF2AYQ1fAADvEwAdDwQ188.jpg "style=" float: none; "title=" Image 23.png "alt=" Wkiom1v4xf2ayq1faadvewaddwq188.jpg "/>

Restart the Samba service again, emptying the cache before logging in.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4A/wKioL1V4XgPjswQPAAFHhw_2XRM161.jpg "style=" float: none; "title=" Image 24.png "alt=" Wkiol1v4xgpjswqpaafhhw_2xrm161.jpg "/>

use aliases to log in, with direct use Lisi User login is an effect.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4E/wKiom1V4XF3gWucxAAOtFpNtowY131.jpg "style=" float: none; "title=" Image 25.png "alt=" Wkiom1v4xf3gwucxaaotfpntowy131.jpg "/>

You can also create a file, and the owner and owner groups of the created file are Lisi.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4A/wKioL1V4XgOxYB88AAJ0K7_eeRQ608.jpg "style=" float: none; "title=" Image 26.png "alt=" Wkiol1v4xgoxyb88aaj0k7_eerq608.jpg "/>

In addition, you can also the main configuration file for the Samba service does address restrictions, a bit like an ACL, where "hosts deny" means Deny, and "hosts allow" is allowed .

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/4E/wKiom1V4XF7CMJ5lAACMKaQJWec876.jpg "style=" float: none; "title=" Image 27.png "alt=" Wkiom1v4xf7cmj5laacmkaqjwec876.jpg "/>

at this time on the Win7 no matter what the user is not able to access Samba services, but can be ping -pass.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4A/wKioL1V4XgSwhAegAAPOOqFFiA4931.jpg "style=" float: none; "title=" Image 28.png "alt=" Wkiol1v4xgswhaegaapooqffia4931.jpg "/>

below are the Install Samba client software on Linux and use "smbclient-l plus IP" After installation is complete You can access The shared files above the win 7.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/4E/wKiom1V4XF_SF-gkAAQFtZj3Gmg066.jpg "style=" float: none; "title=" Image 29.png "alt=" Wkiom1v4xf_sf-gkaaqftzj3gmg066.jpg "/>

Experience Summary: Installation be careful not to mistake the samba service package. The various configuration parameters in the Samba master configuration file need to be clear, and the parameters for anonymous access and authentication access are not mixed up. There is the problem of permissions, and sometimes it is necessary to check the permission settings. Thank you! 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/4A/wKioL1V4YqHxe11LAAAd16RwZB0672.jpg "title=" Picture 30.png "alt=" wkiol1v4yqhxe11laaad16rwzb0672.jpg "/> really very hard, support a bit.


This article is from the "My World" blog, please be sure to keep this source http://zhang2015.blog.51cto.com/9735109/1660691

Full configuration operation of Samba server in Linux

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.