Linux Samba Server Configuration exercise

Source: Internet
Author: User
Tags mkdir valid ssh

Environment

RedHat Linux 9 + vwware 8.0 + SSH 3.2.9

Task requirements

Use the Samba service to complete the following tasks:

If the company has financial, technical, leading 3 departments, we have 3 departments to establish 3 user groups for Caiwu,network,lingdao;

Three departments have 2 users, we build users are caiwu01,caiwu02,network01,network02, lingdao01,lingdao02

1, first the server in the way of user authentication, each user can access their own host directory, and only the user can access the host directory, and have full permissions, and other people can not see your host directory

2, the establishment of a Caiwu folder, I hope that the Caiwu group and Lingdao group can see, network02 can also access, but only caiwu01 have the right to write.

3, the establishment of a Lindao directory, only the leadership group can access and read and write, and network02 also can visit, but outsiders do not see that directory

4, establish a file Exchange directory exchange, everyone can read and write, including the guest user, but everyone can not delete other people's files.

5. Create a public read-only folder publicly, and everyone reads only the contents of the folder.

Authentication method:

For example, log on to SSH with a caiwu01 user, and then verify that the Samba service is configured correctly with the following command

Smbclient the name of the shared file in the//linuxip/samba configuration file

For example, in SSH, enter the following command: Smbclient//192.168.78.100/share

Related commands

1. Establishment of 3 groups: Groupadd Caiwu;     
Groupadd Network;     
         
Groupadd Lingdao;     
2. Add users and join related groups: Useradd caiwu01-g Caiwu;     
Useradd caiwu02-g Caiwu;     
Useradd NETWORK01-G Network;     
Useradd NETWORK02-G Network;     
Useradd lingdao01-g Lingdao;     
         
Useradd lingdao02-g Lingdao;     
3. Use smbpasswd to add Samba password smbpasswd caiwu01 for each user;     
SMBPASSWD caiwu02;     
SMBPASSWD network01;     
SMBPASSWD network02;     
SMBPASSWD lingdao01;     
         
SMBPASSWD lingdao02;     
4. We use the Smbpasswd-a caiwu01 command to add 6 accounts to the Samba user smbpasswd-a caiwu01 respectively;     
Smbpasswd-a caiwu02;     
Smbpasswd-a network01;     
Smbpasswd-a network02;     
Smbpasswd-a lingdao01;     
         
Smbpasswd-a lingdao02;     
5. Create a directory to use: Mkdir/home/samba;     
Mkdir/home/samba/caiwu;     
Mkdir/home/samba/lingdao;     
Mkdir/home/samba/exchange;     
         
Mkdir/home/samba/public; To avoid trouble, you can set the permissions on all the folders above to 777 through Samba's flexible permissionsManagement to set up the above 5-point requirements. 6. Configure smb.conf smb.conf configuration file [Global] workgroup = bmit #我的网络工作组 Server string = Frank's S Amba file Server #我的服务器名描述 security = user #使用用户验证机制 Encrypt passwords = yes smb passwd File =/e  TC/SAMBA/SMBPASSWD #使用加密密码机制, Win95 and Winnt are used in plaintext 7.homes paragraphs to satisfy the 1th piece [caiwu01] comment = Caiwu01 browseable = yes writeable = yes Path =/home/caiwu01 Valid users = caiwu01 [C AIWU02] Comment = caiwu02 browseable = yes writeble = yes path =/home/caiwu02 [Network Comment = network01 browseable = yes writeable = yes Path =/home/network01 Valid users = Net work01 [network02] comment = network02 browseable = yes writeable = yes Path =/home/ne Twork02 Valid users = network02 [lingdao01] comment = lingdao01 broWseable = yes writeable = yes Path =/home/lingdao01 Valid users = lingdao01 [lingdao02]     
         
         
Comment = lingdao02 browseable = yes writeable = yes Path =/home/lingdao02 Valid users = lingdao02 8.caiwu segment meets our 2nd requirement [Caiwu] comment = Caiwu Path =/home/samba/caiwu public = n     
         
O Valid users = @caiwu, @lingdao, network02 write list = caiwu01 printable = no #caiwu段满足我们的第2要求 9.lingdao segment can meet our 3rd requirement [Lingdao] comment = Lingdao Path =/home/samba/lingdao public = no B     
         
         
rowseable = no Valid users = @lingdao, network02 printable = no #lingdao段能满足我们的第3要求 10.exchage shared file configuration [exchage] comment = Exchange file Directory path =/home/samba/exchange Public = yes writable = yes #exchange段基本能满足我们的第4要求, but not satisfying everyone cannot delete Man's file This condition, even if the set up mask is notWith, in fact this condition as long as Unix set a sticky bit on the line Chmod-r 1777/home/samba/exchange Note that the permissions are 1777, similar system directory/TMP has the same permissions  , this permission can realize everyone can write the file freely, but cannot delete other people's file this request 11. This public segment satisfies our 5th requirement [public] comment =     
         
Read only public path =/home/samba/public Public = yes Read Only = yes #这个public段能满足我们的第5要求.

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.