Samba service Overview

Source: Internet
Author: User
Full introduction to Samba-Linux Enterprise Application-Linux server application information. For more information, see the following section. Main functions of Samba: (relevant content is prepared based on the video of instructor Yu Fei)
1. Provides windows-Style File Sharing and printer sharing;
2. Resolve the NETBIOS name in a windows network;
3. Provide SMB client functions (accessed via FTP );
Samba service access:
1. smbclient-L // host name or IP-U login username % password; # access Shared resources;
2. smbclient // host name or IP/shared directory name-U login username % password; # use shared resources;
3. mount // target host IP Address/shared directory name mount point-O username = username % password; # mount shared resources to a local host;
4. smbtar-S destination host IP address-U user-P passwd-x shared file name-t output.tar; # back up the remote file to the local host;
5. tar tvf *. tar; # view the content of the tar package;

Samba Case 1:
Create a shared directory share. The local path is "/home/share". Only users in the linux Group can read and write this directory. users in the cisco group can only read this directory.
Resolution: 1. Create the directory "/home/share" on the local host ";
2. Create two user groups for linux and cisco: groupadd linux and groupadd cisco;
3. Create two users: useradd dxp and useradd hp;
4. Add the two users to the linux and cisco groups: usermod-g linux dxp and usermod-g cisco hp;
5. Add the dxp and hp users to the Samba server: smbpasswd-a dxp and smbpasswd-a hp;
6. Change the/home/share user group to cisco: chgrp cisco/home/share;
7. Change/home/share permissions: chmod 757/home/share, chmod g + s/home/share;
8. Edit the main configuration file smb. conf of the Samba service: vim/etc/samba/smb. conf;
9. Change the following content in smb. conf:
I. Change workgroup to the same working group as windows;
II. Change the security level of samba access: security = user;
III. Add at the end of smb. conf:
[Share]
Comment = share files
Path =/home/share
Valid users = @ linux @ cisco
Wrire list = @ linux
10. Save and exit smb. conf and start the Samba service: service smb start
11. Then go to the windows client for verification.
Note: to allow windows to successfully access the Samba server, you must enable the samba service in the firewall of the linux system and disable the SElinux function.

Case 2:
The company has two departments (sales and markets). The sales and marketing departments have their own shared directories, which can only be accessed by the General Manager and employees of the corresponding departments, in addition, employees of the Company are prohibited from accessing shared directories that are not in the department.
Analysis: 1. Create two groups: groupadd sales and groupadd markets;
2. Create related users (as needed): useradd linux, useradd cisco, and useradd ceo;
3. Add the created users to the sales and markets groups: usermod-g sales linux and usermod-g markets cisco;
4. Add linux and cisco users to the Samba server: smbpasswd-a linux, smbpasswd-a cisco, and smbpasswd-a ceo;
5. Create a shared directory between the sales department and the marketing department: mkdir/home/sales, mkdir/home/markets;
6. Change the user group that the sales department shares with the marketing department: chgrp sales/home/sales, chgrp markets/home/markets;
7. Change the permission of the sales department and the marketing department's photo directory: chmod g + s/home/sales, chmod g + s/home/markets;
8. Change the general manager's permissions to the marketing department and sales Department: chown ceo/home/sales, chown ceo/home/markets;
9. Change the permission of the marketing department and sales department group to share the Directory: chmod 770/home/sales, chmod 770/home/markets;
10. Edit the main configuration file smb. conf of the Samba service: vim/etc/samba/smb. conf;
11. Change the following content in smb. conf:
I. Change workgroup to the same working group as windows;
II. Change the security level of samba access: security = user;
III. Add at the end of smb. conf:
[Sales]
Comments = sales
Path =/home/sales
Valid users = @ sales ceo
Write list = @ sales ceo
Create mask = 770
Directory mask = 770
[Markets]
Comments = markets
Path =/home/markets
Valid users = @ markets ceo
Write list = @ markets ceo
Create mask = 770
Directory mask = 770
12. Disable the Home Directory of each user in smb. conf, save and exit;
13. start the Samba service: service smb start;
14. Then go to the windows client for verification.


The above two cases are based on the video prepared by instructor Yu Fei. I hope they will be of some use to everyone.
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.