Study with me in linux 4

Source: Internet
Author: User
Learn linux with me 4-Linux Enterprise Application-Linux server application information. The following is a detailed description. Lesson 3
In the previous lesson 2nd, we have talked about how to set up a samba server, however, because the samba server is a very important server, I decided to present a case to everyone, hoping that we could get more help in setting up the samba server, if you haven't seen Lesson 1st or lesson 2nd before, Please study and I think it will be helpful to you. I 've been using the red union technology. Okay, come on.
1. Case requirements
A. All employees can work in the company, but no matter on a computer, they must store their files on the samba file server.
B. Both the marketing department and the technical department have their own directories, and the same department has their own shared directories. Other departments can only access their own/home directories on the server.
C. No user can use the shell on the server.
2. for the first requirement, we need to make samba a file server and create accounts and directories for the users. By default, all users have a directory under/home, which can only be seen after authentication, for the second requirement, we create different groups of shichang and jishu for the marketing department and the technology department, sharing shichang and technology through samba. For the third requirement, shell is not allocated when a user is created.
3. let's assume that the marketing department has steamed stuffed bun, dumplings, and the technology department has radish and cabbage. The general manager is gambling God. The finance department is gambling God. We want to add steamed stuffed bun and dumplings to shichang radish cabbage and jishu, create two directories:/home/shichang/home/jishu, which belong to the marketing department and the technology department.
4. Create a group [root @ zy root] # groupadd jishu,
[Root @ zy root] # groupadd shichang,
Create a user [root @ zy root] # useradd baozi. Similarly, I will not create any more
Then we will add the user to the two groups [root @ zy root] # useradd-g shichang-s/bin/false baozi
[Root @ zy root] # useradd-g shichang-s/bin/false jiaozi where-g points to the group,-s/bin/false cannot use the shell on the server
[Root @ zy root] # useradd-g jishu-s/bin/false luobu
[Root @ zy root] # useradd-g jishu-s/bin/false baicai
5. To access the smb server, add these people to the smb authentication database, including dusloud and dusheng.
[Root @ zy root] # smbpasswd-a baozi where-a is used to add a user, and then enter the password. Here I set the password to the same name as that of the other users, after the preceding settings, we need to confirm the following [root @ zy root] # more/etc/samba/smbpasswd
6. Then we created the directory.
[Root @ zy root] # mkdir/home/jishu/home/shichang
Then we can view the permissions of these two directories and find that they are all in the root administrator group [root @ zy root] # ls-ld/home/jishu
We need to assign these two directories to the jishu and shichang groups respectively.
[Root @ zy root] # chgrp jishu/home/jishu
[Root @ zy root] # chgrp shichang/home/shichang
Then we need to change the default permission to 755. We need to change it to 770. Here, we will introduce the first 7, that is, the owner of the file, reading 4, and writing 2, execute is 1 and add up to 7. The second 5 is the permission of the group where the file owner is located. read and execute add up to 5. The third 5 is that other users and groups can also read and execute.
[Root @ zy root] # chmod 770/home/jishu
[Root @ zy root] # chmod 770/home/shichang
Then confirm the permission [root @ zy root] # ls-ld/home/jishu
Of course, we should not forget dusloud and dusheng.
[Root @ zy root] # chgrp dushen/home/dushen
[Root @ zy root] # chgrp dusheng/home/dusheng
[Root @ zy root] # chmod 700/home/dushen
[Root @ zy root] # chmod 700/home/dusheng
7. Then we need the smb configuration file.
[Root @ zy root] # vi/etc/samba/smb. conf.
A. Note that workgroup = corresponds to the current windows user group.
B. security = user. To determine whether the security level is "user", You need to log on with the user name.
C. What do I not understand for reference to my written http://www.linuxdiyf.com/viewarticle.php? Id = 52230. Be sure to stick to me. Your support is the motivation of my writing.
We need to write at the end
[Jishu]
Path =/home/jishu path
Comment = jishu description
Public = no sharing
Valid users = @ jishu valid user @ jishu refers to
Write list = @ jishu users that can be written
Creast mask = 0770 File Permissions
Directory mask = 0770 directory Permissions
Similarly, shichang was written by everyone.
[Root @ zy root] # Save and exit wq
[Root @ zy root] # service smb restart to restart the smb service
[Root @ zy root] # smbclient-L 192.168.1.144-U baicai % 123 then let's test that 123 is the baicai Password
[Root @ zy root] # tail/var/log/samba/zy. log when an error occurs, we need to learn to view the log. By default, all the logs are under/var/log/samba/. My host name is zy, so it is zy. log
We use a client from the technical department to access the server. First, select a network neighbor to find the smb server zy. Then, it will prompt you to enter the user name and password.
After a tip, we can find the technology folder. We can click it and right-click it, select ing the network drive, and start a random z:
In this way, we can see the z disk on our computer and operate it on the z disk. In fact, the z disk is/home/jishu in the smb server.
Of course, this requirement must be a member of the technical department before it can be modified.
I strongly urge you to support me. I will study with you every day.
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.