Samba Startup and shutdown
/ETC/INIT.D/SMB restart
/ETC/INIT.D/NMB restart
[Global]
Workgroup = MyGroup #工作组 (can be set by itself)
Server string = Samba server Version%v #设置samba服务器名称 (you can set it yourself)
Log file =/var/log/samba/log.%m #日志存放路径
Max log size = 50
Security = User #设置samba服务器安全级别为user, which is accessed by account and password
Passdb backend = Tdbsam
Load printers = yes
Cups options = raw
[develop_php] #在WIN7上看到的共享目录的名字
Comment = Public Stuff
Path =/share #共享文件地址
public = yes #公开目录
writable = yes #共享目录可以读写
printable = no
Write list = +staff
############################################################################################################### ##########
Permissions settings for Samba users
Reference Link: http://cells.blog.51cto.com/701962/755367/
Requirement 1: There is a shared directory for rule, which puts the company's rules and regulations, all users can view, but can not modify
Workaround: Configure Read Only = Yes in smb.conf, as follows: Remember to restart Samba because there is no write permission, you need to upload the file from the server side
[Rule]
Comment = Rule
Path =/rule
Read Only = yes
public = No
Vaild users = TheWorld
The simplest configuration
[Rule]
Comment = Rule
Path =/rule
Read Only = yes
Requirement 2: Some people only have permission to file1 this directory, some people only have permission to file2 this directory
Workaround:
1, first set up two samba users User1 and User2, these two users to ensure that the Linux system exists in the user, the command is as follows:
#smbpasswd-A User1
2, then set the access rights to the directory File1 and File2, let the user user1 access File1, the user user2 access file2, the command is as follows:
#chown User1:user1/var/samba/file1
#chmod 700/var/samba/file1 #这一步很关键
3. Configure access rights for File1 and File2 in smb.conf, as shown in the following example:
[File1]
Path =/var/samba/file1
Read Only = no
public = No
Vaild users = User1
4. When the client logs on to the Samba service, the user name assigned to the user User1 to access the File1, the user name of the file2 user user2.
My specific configuration is as follows
[File1]
Comment = File1
Path =/file1
Read Only = no
Public = yes
Vaild users = User1
[File2]
Comment = File2
Path =/file2
Read Only = no
Public = yes
Vaild users = User2
Samba must remember to restart
Demand 3: User1 to file1 this directory has read and write permissions, user2 only to file1 this directory has read-only permissions
Usermod-g user1 User2 #把user2添加到附属组user1
chmod 770 File1 #设置file1的所属组有访问权限
The specific configuration is as follows:
[File1]
Comment = File1
Path =/file1
public = No
Vaild users = @user1
Write list = User1
Read List = User2 #user2只有只读权限
Win7 clearing the Samba sharing password
Under DOS,
NET use */del
On Win7, \\192.168.10.34 enter user2 username and password, you will find that the File1 directory has read-only permission
Requirement 4:
Only the people in the User2 group have permission to file2 this directory, and all users in the User2 group have read and write permissions, it is worth noting that the permissions of new folders and files will be different when the permissions are set.
Causes the same group of users to have Read permission without write permission, so specify permissions for new files and folders in the configuration file
Workaround:
1, first set up the required number of Samba users, these users to ensure that the Linux system exists in the user, and in the same user group User2, create the same method as above
useradd-u1505 abc-s/bin/false
USERMOD-G user2 ABC #添加附加组
SMBPASSWD-A ABC
Chmod-r 770/file2/#这一步也很重要
Specific configuration
[File2]
Comment = File2
Path =/file2
Read Only = no
Public = yes
Create mode = 0770
Directory mode = 0770
Vaild users = @user2
Write list = @theworld
Or
[File2]
Comment = File2
Path =/file2
Read Only = no
Public = yes
Vaild users = @user2
Write list = @theworld
In other words, whether the newly created file or directory becomes read-only, the key is that chmod-r 770/file2/is not an add-r parameter, regardless of the two parameters of Create mode directory mode
This article is from the "Youth Deng Yong" blog, please be sure to keep this source http://dengyong.blog.51cto.com/8409869/1791071
Samba configuration file description and permission settings