Application Cases
Requirements:
1. All employees can work in the company, But no matter which computer they work on, they must save their file data on the Samba file server.
2. Both the marketing department and the technical department have their own directories. People in the same department have a shared directory. People in other departments can only access their own home directories on the server.
3. All users are not allowed to use the shell on the server.
Analysis:
1. Samba needs to be used as the file server to create accounts and directories for all users. By default, a user has a home directory on the server, which can be seen only after authentication is passed.
2. You need to create different sales and tech groups for the marketing department and the Technical Department, allocate directories, and add all marketing department employees to the sales group. the technical department employees should join the tech group and share the sales and tect through Samba.
3. No shell is allocated when a user account is created.
Case implementation:
1. Create accounts and directories for all users without assigning shell. Assume that the marketing department has Tom and Jack, and the technical department has red, blue, CEO of general manager, and finance.
2. Create sales and tech groups, add all marketing department employees to the sales group, and Technical Department employees to the tect group.
3. Create two directories/home/sales and/home/Tech, and modify the permissions of the two directories, which belong to the sales group and tect group respectively.
4. Share/home/sales and/home/tect through samba
5. Test
If any error occurs, check
/Etc/samba/smbpasswd determine account
/Etc/samba/smbusers view the ing File
Tail/var/log/samba/RedHat. log view logs in the/var/log/samba/directory
Specific operations:
# The vi/etc/samba/smb. conf security level is user
# Groupadd sales
# Groupadd tech
# Useradd-G sales-S/bin/false Tom
# Useradd-G sales-S/bin/false Jack
# Smbpasswd-a Tom
# Smbpasswd-a Jack
# For user in Red blue
> Do
> Useradd-G tech-S/bin/false $ user
> Smbpasswd-A $ user
> Done
# Useradd CEO
# Useradd Finance
# Smbpasswd-a CEO
# Smbpasswd-A Finance
# Mkdir/home/sales/home/Tech
# Chgrp sales/home/sales
# Chgrp tech/home/Tech
# Chmod 770/home/sales
# Chmod 770/home/Tech
# Chmod g + S/home/sales prevent permission confusion
# Chmod g + S/home/Tech
# Vi/etc/samba/smb. conf
[Global]
Path =/home/sales
Comment = Sales
Public = No
Valid users = @ sales
Write list = @ sales
Create mask = 0770
Directory mask = 0770
[Tech]
Path =/home/Tech
Comment = tech
Public = No
Valid users = @ tech
Write list = @ tech
Create mask = 0770
Directory mask = 0770
Linux Testing
1. smbclient-l 192.168.0.22-u Tom % Tom
2. Mount. CIFS // 192.168.0.22/CEO-O username CEO % CeO
The Windows client maps the network drive, and then sets the "My Documents" location to store files on the Samba server anytime, anywhere.