Setting up Samba services on Linux servers for file sharing

Source: Internet
Author: User

Experiment



Lab Environment:

A Linux server and a real computer on a virtual machine

Experimental requirements:

One, the client can access the Linux server files anonymously;

Second, the client needs user authentication to access the Linux files;

Third, create a shared account alias to implement the login;

Four, the limit of access address;

Five, the Linux host queries the target host to share the resource list and log in and access the shared folder;

Six, mount the shared folder with Mount;



Experimental steps:

One, anonymous access to Linux server files

To install the Samba service program:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/83/wKiom1TU_jLxFJP5AAGT5hWU6r0030.jpg "style=" float: none; "title=" 1.png "alt=" Wkiom1tu_jlxfjp5aagt5hwu6r0030.jpg "/>


See if Samba installs the full

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/80/wKioL1TU_yCzra9BAAB9dbkHBhg549.jpg "style=" float: none; "title=" 2.png "alt=" Wkiol1tu_yczra9baab9dbkhbhg549.jpg "/>


Filter "#" and ";" symbols when importing the smb.conf configuration file for editing

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/83/wKiom1TU_jKxJQDJAAB_Ut4pT6s964.jpg "style=" float: none; "title=" 3.png "alt=" Wkiom1tu_jkxjqdjaab_ut4pt6s964.jpg "/>



Edit the smb.conf profile using the VI editor and set the security level to anonymous access

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/83/wKiom1TU_jKhzPBpAADFyb17AXc509.jpg "style=" float: none; "title=" 4.png "alt=" Wkiom1tu_jkhzpbpaadfyb17axc509.jpg "/>



Specify the path to the shared file and set allow all users to access

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/80/wKioL1TU_yDh0tuCAAA--Kvv9UM160.jpg "style=" float: none; "title=" 5.png "alt=" Wkiol1tu_ydh0tucaaa--kvv9um160.jpg "/>




Create a file named 111.txt under the/opt/abc folder

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/80/wKioL1TU_2DxeuLIAABpsW9Rp00988.jpg "style=" float: none; "title=" 6.png "alt=" Wkiol1tu_2dxeuliaabpsw9rp00988.jpg "/>



To turn off firewall features:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/83/wKiom1TU_nLhD3SLAABo5IKlH6c697.jpg "style=" float: none; "title=" 7.png "alt=" Wkiom1tu_nlhd3slaabo5iklh6c697.jpg "/>



Test the login server to view the shared folder:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/80/wKioL1TU_2DjAaUzAACgqIkMGiM583.jpg "style=" float: none; "title=" 8.png "alt=" Wkiol1tu_2djaauzaacgqikmgim583.jpg "/>




Second, a user-authenticated share is required:

To add a Samba user and set a password:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/80/wKioL1TU_2CjDngRAACBSZ4Udkg904.jpg "style=" float: none; "title=" 9.png "alt=" Wkiol1tu_2cjdngraacbsz4udkg904.jpg "/>




To edit the security level for user mode:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/83/wKiom1TU_nKySxP9AACDACqSb-I659.jpg "style=" float: none; "title=" 10.png "alt=" Wkiom1tu_nkysxp9aacdacqsb-i659.jpg "/>



Set the shared file path, the file is visible, set the user's permission to upload the file box directory, and specify the user:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/80/wKioL1TU_8mSypatAABKcw4X30Q886.jpg "style=" float: none; "title=" 11.png "alt=" Wkiol1tu_8msypataabkcw4x30q886.jpg "/>



To restart the SMB service:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/83/wKiom1TU_tuR-alAAABUqzDRrbs935.jpg "style=" float: none; "title=" 12.png "alt=" Wkiom1tu_tur-alaaabuqzdrrbs935.jpg "/>



Create a file abc.txt under/opt/test:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/80/wKioL1TU_8mTdzh-AABQCPKuS9A319.jpg "style=" float: none; "title=" 13.png "alt=" Wkiol1tu_8mtdzh-aabqcpkus9a319.jpg "/>



To set the shared folder to the maximum permissions:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/83/wKiom1TU_tvD3o2lAABwcCDgf8c069.jpg "style=" float: none; "title=" 14.png "alt=" Wkiom1tu_tvd3o2laabwccdgf8c069.jpg "/>



Test Using User login:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/80/wKioL1TU_8mw7oqjAABQLK-qKZA901.jpg "style=" float: none; "title=" 15.png "alt=" Wkiol1tu_8mw7oqjaabqlk-qkza901.jpg "/>





To test Write permissions:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/83/wKiom1TU_vagQVO2AAFVJ6852Mk912.jpg "style=" float: none; "title=" 16.png "alt=" Wkiom1tu_vagqvo2aafvj6852mk912.jpg "/>



To view on the server:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/80/wKioL1TU_-SRHqJxAABBWy5kXG0642.jpg "style=" float: none; "title=" 17.png "alt=" Wkiol1tu_-srhqjxaabbwy5kxg0642.jpg "/>



Three, shared account mapping:


Edit the/etc/samba/smbusers configuration file using the VI editor and set the user alias at the end:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/83/wKiom1TU_vagnpOEAACJ7ftalU4553.jpg "style=" float: none; "title=" 18.png "alt=" Wkiom1tu_vagnpoeaacj7ftalu4553.jpg "/>



To add a configuration item in global mode:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/80/wKioL1TU_-WjDtF_AACkSKFbQ1Y792.jpg "style=" float: none; "title=" 19.png "alt=" Wkiol1tu_-wjdtf_aackskfbq1y792.jpg "/>



To restart the SMB service:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/83/wKiom1TU_vfwwCLuAABYO6d10S4138.jpg "style=" float: none; "title=" 20.png "alt=" Wkiom1tu_vfwwcluaabyo6d10s4138.jpg "/>




Test log in using a user alias:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/83/wKiom1TU_xHi-rZVAABdgnKXQqg583.jpg "style=" float: none; "title=" 21.png "alt=" Wkiom1tu_xhi-rzvaabdgnkxqqg583.jpg "/>



To access a shared folder:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/80/wKioL1TVAADCT9UbAAC4h0VmAfk572.jpg "style=" float: none; "title=" 22.png "alt=" Wkiol1tvaadct9ubaac4h0vmafk572.jpg "/>




Four, access address restrictions:

Configure Shared Folders test prohibits 192.168.100.0 network segment access:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/83/wKiom1TU_xLxE6i7AABkMYK_57g304.jpg "style=" float: none; "title=" 23.png "alt=" Wkiom1tu_xlxe6i7aabkmyk_57g304.jpg "/>



To restart the SMB service:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/80/wKioL1TVAADzoV_kAABb4xOnGJU387.jpg "style=" float: none; "title=" 24.png "alt=" Wkiol1tvaadzov_kaabb4xongju387.jpg "/>




Test the user login access, the 100.0 network segment will not be accessible:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/80/wKioL1TVAADxWgSkAAD4Dd4d4Cs580.jpg "style=" float: none; "title=" 25.png "alt=" Wkiol1tvaadxwgskaad4dd4d4cs580.jpg "/>




Five, the Linux host query the host's shared resources list and log in to access the folder download file

To create a shared folder on the target host:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/83/wKiom1TU_yqC_f5EAACnEY2xiD0851.jpg "style=" float: none; "title=" 26.png "alt=" Wkiom1tu_yqc_f5eaacney2xid0851.jpg "/>



Enable Guest Guest User:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/80/wKioL1TVABmgvaiFAAEdBfbyd18123.jpg "style=" float: none; "title=" 27.png "alt=" Wkiol1tvabmgvaifaaedbfbyd18123.jpg "/>



Set the network access mode to guest only:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/83/wKiom1TU_yuh7Se5AADzVp8EhsE465.jpg "style=" float: none; "title=" 28.png "alt=" Wkiom1tu_yuh7se5aadzvp8ehse465.jpg "/>




To log in and access the shared folder using the smbclient command download the file using the Mget command:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/80/wKioL1TVABmg4KMNAAJWVD_hUHc602.jpg "style=" float: none; "title=" 29.png "alt=" Wkiol1tvabmg4kmnaajwvd_huhc602.jpg "/>



Switch to the root directory to view the downloaded files:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/83/wKiom1TU_yvBtp_ZAABLpsPBFMY006.jpg "style=" float: none; "title=" 30.png "alt=" Wkiom1tu_yvbtp_zaablpspbfmy006.jpg "/>




Six, mount the shared folder using mount:

Create two files on the target host's shared files directory:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/80/wKioL1TVADHAGSSSAACfIKeP9eM180.jpg "style=" float: none; "title=" 31.png "alt=" Wkiol1tvadhagsssaacfikep9em180.jpg "/>



Use the Mount command to mount the target host Guest user's shared files directory to the local directory/smbdir to view the mounted directory:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/83/wKiom1TU_0KzZ9siAAGlsUx5hK8864.jpg "style=" float: none; "title=" 32.png "alt=" Wkiom1tu_0kzz9siaaglsux5hk8864.jpg "/>



Copy the shared file to the local root directory:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/83/wKiom1TU_0OgjpqxAABmHjJxFgk905.jpg "style=" float: none; "title=" 33.png "alt=" Wkiom1tu_0ogjpqxaabmhjjxfgk905.jpg "/>



To view the root directory:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/80/wKioL1TVADGhUvOrAAB5AW7MyKo933.jpg "style=" float: none; "title=" 34.png "alt=" Wkiol1tvadghuvoraab5aw7myko933.jpg "/>


Experiment completed


This article from "Joint efforts, common progress ~ ~" blog, please be sure to keep this source http://9067358.blog.51cto.com/9057358/1612551

Setting up Samba services on Linux servers for file sharing

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.