I. Requirements:
1. The company has two departments: Art Department and operation department.
2. There are three folders: meishu, yunying, and public.
3. Public includes meishu and yunying
4. the art department can read and write the meishu and public/meishu files. It does not have permission to open the yunying folder or read the public/yunying files;
5. The operation department can read and write the yunying and public/yunying files. The operation department has no permission to open the meishu folder and read the public/meishu files;
2. Enable the port corresponding to the samba firewall or directly disable the firewall.
#/Etc/init. d/iptables stop
Set SELinux = disabled in config under/etc/SELinux
3. Install samba
1. # Yum-y install samba-client samba-SWAT
The dependent packages samba-common, samba-winbind-clients, and libsmbclient are automatically installed.
Start Samba:
#/Etc/init. d/SMB start
#/Etc/init. d/nmb start
2. Set startup
# Chkconfig -- add SMB
# Chkconfig -- add nmb
# Chkconfig SMB on
# Chkconfig nmb on
4. Configure samba
The configuration file is/etc/samba/smb. conf.
1. Create related users and user groups
# Useradd-S/sbin/nologin msadmin
# Useradd-G msadmin-S/sbin/nologin Maomao
# Useradd-S/sbin/nologin yyadmin
# Useradd-G yyadmin-S/sbin/nologin zyq
# Useradd-S/sbin/nologin Admin
2. Set the User Password
# Smbpasswd-A msadmin (others are similar)
3. Create a folder
# Mkdir-P/home/{meishu, yunying, public}
# Mkdir-P/home/public/{meishu, yunying}
4. Set folder Permissions
# Cd/home
# Chown msadmin. msadmin meishu
# Chown yyadmin. yyadmin yunying
# Chown Admin. Admin public
# Cd/home/Public
# Chown msadmin. msadmin meishu & chown yyadmin. yyadmin yunying
# Chmod 1775 meishu yunying)
5. Configure smb. conf as follows:
#====================================== Global settings ==================== ======================================
[Global]
# ----------------------- Network related options -------------------------
#
# Workgroup = Nt-Domain-Name or workgroup-name, eg: midearth
#
# Server String is the equivalent of the NT Description field
#
# NetBIOS name can be used to specify a server name not tied to the hostname
Workgroup = workgroup
Server String = shyy Samba server version % v
NetBIOS name = shyysamba
# --------------------------- Logging options -----------------------------
#
# Log file let you specify where to put logs and how to split them up.
Log File =/var/log/samba/log. % m
Max log size = 50
# ----------------------- Standalone server options ------------------------
#
# Scurity can be set to user, share (Deprecated) or server (Deprecated)
Security = user
Passdb backend = tdbsam
#============================ Share definitions ========== ==================================
[Meishu]
Comment = This is a directory of meishu.
Path =/home/meishu
Public = No
Admin users = msadmin
Valid users = @ msadmin
# Writable = Yes
Write list = @ msadmin
Create mask = 0750
Directory mask = 0750
[Yunying]
Comment = This is a directory of yunyhing.
Path =/home/yunying
Public = No
Admin users = yyadmin
Valid users = @ yyadmin
# Writable = Yes
Write list = @ yyadmin
Create mask = 0750
Directory mask = 0750
[Renshi]
Comment = This is a directory of Renshi.
Path =/shyygame/Renshi
Public = No
Admin users = hradmin
Valid users = @ hradmin
# Writable = Yes
Write list = @ hradmin
Create mask = 0750
Directory mask = 0750
[Public]
Comment = This is a share directory.
Path =/home/Public
Public = No
Valid users = admin, @ hradmin, @ msadmin, @ yyadmin
Write list = @ msadmin, @ yyadmin, @ hradmin
# Writable = Yes
Create mask = 0750
Directory mask = 0750
Test configuration command: # testparm
5. Logon
1. Connect the Linux client to the Shared Server
# Smbclient // ip/Public
2. Connect the Windows client to the Shared Server
In the address bar, enter \ IP or double-click the shared machine in the network neighbor. Then, enter the account password.
Install and configure the Samba File Server in centos