Linux under the SMB file sharing server detailed
1.SMB Server, NetBIOS work Port 137/UDP,138/UDP,139/TCP, shared file work Port 445/tcp
The 2.SMB server is primarily a file-sharing service running between Linux and Windows,
There are four user,share,server,domain of security level
User: Equivalent to the use of customer authentication
Share: equivalent to anonymous access
Server: Equivalent to user authentication on another server
Domain: equivalent to using Windows AD domains user authentication
There are 3 users of 3.SMB authentication, including local system, account on non-local server and AD domain account of Windows.
Note: If the user authentication is local system, it must be the system account, for system security reasons, the password must be created separately
Instead of the password for the local System account, use the SMBPASSWD command to create the SMB user password
format; smbpasswd [options] User name
Smbpasswd–a Willow will willow users to create SMB identities and setup passwords
smbpasswd-d Willow Disable Willow User SMB identity
smbpasswd-e Willow Enable Willow user SMB identity
Smbpasswd-x Willow Remove Willow User SMB identity
Testparm Test SMB config file OK command
4. catalog file: The intersection of Share permissions and file system permissions
5.SMB Master configuration file
Vim/etc/samba/smb.conf
[Shared directory name]
Comment = Comment information
Path =/path #共享路径
browseable = {Yes|no} #目录是否可浏览
public = {Yes|no} #是否允许匿名访问 with the same function as guest OK
Guest OK = {Yes|no} #是否允许匿名访问, function as public
Read Only = {Yes|no} #是否可读或可写, function as writable
writable = {Yes|no} #是否可读或可写 with the same function as read only
Write list = User1,user2 ..., @group, +group ... # users or groups that allow writable permissions
Valid users = User1,user2 ... #允许可写权限的用户
Invalid users = User1,user2 ... #不允许可写权限的用户
6. Experiment: Build Samba server under Linux with IP address 1.1.1.66, share directory as/smb/test, share named Tools,
Write permission only for Willow users and willow user groups
Yum Install-y Samba Samba-client Samba-common
Mkdir-pv/smb/test #创建共享目录
Useradd Willow #创建本地系统用户willow
Smbpasswd-a Willow #新增willow用户的smb密码
Vim/etc/samba/smb.conf
[Tools]
Comment = Tools is testing
Path =/smb/test
Public = yes
Write list = Willow, @willow
Service SMB Start
At this point, access to the 1.1.1.66SMB server, although set the Willow user has write sharing permissions ,
But Willow user does not have write file system permission to/smb/test directory, I have already said
The final permissions are equal to the sharing permissions and the file system permissions, which must be done in the following steps:
Setfacl-m U:willow:rwx/smb/test
Setfacl-m G:willow:rwx/smb/test
7.smbclient command
If you view the SMB Service share directory:
SMBCLIENT-L SMB Server IP address-u SMB user name
such as: Smbclient-l 1.1.1.66-u Willow
If you want to manipulate the SMB service like an FTP service:
Smbclient//SMB Server IP address/directory share name-u SMB user name
such as: smbclient//1.1.1.66/tools-u Willow
8.swat Services: SMB Web Management tool that enables users to manage SMB servers through web pages
Yum Install-y Samba-swat
Since SWAT is a transient daemon, managed by the XINETD Super Daemon, you must first start the XINETD service
Service xinetd Start
Chkconfig SWAT on open SWAT service
Manually modifying the SWAT service configuration file
Vim/etc/xinetd.d/swat #以下红色部色作相应修改
Service SWAT
{
Disable = no #开启swat服务
Port = 901
Socket_type = Stream
wait = no
Only_from = 1.1.1.0/24 #此网段内可以使用swat服务通过web管理smb
user = root
Server =/usr/sbin/swat
Log_on_failure + = USERID
}
Service xinetd Restart
Service SMB Restart
Clients log in to the SMB server via the Web: the first time must be logged in with the root account and password, followed by a change password or create account
http://1.1.1.66:901
The last web page to manage SMB is as follows:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/82/8F/wKioL1daw3XD3PGkAAMANtKPS5Q889.jpg-wh_500x0-wm_3 -wmp_4-s_1736127756.jpg "title=" 1.jpg "alt=" Wkiol1daw3xd3pgkaamantkps5q889.jpg-wh_50 "/>
This article is from the "Xavier Willow" blog, please be sure to keep this source http://willow.blog.51cto.com/6574604/1787827
Linux under the SMB file sharing server detailed