As a server-side implementation:
Smb:service Message Block----PROGRESS:SMBD port:445/tcp
NetBIOS: Local name resolution--------PROGRESS:NMBD port:137/udp 138/udp 139/tcp
Installation:
[email protected]/]# Yum install samba-y
Start:
[[email protected] /]# /etc/init.d/smb startstarting SMB services: [ ok ][[email protected] /]# /etc/init.d/ nmb startstarting nmb services: [ ok ]
Windows view:650) this.width=650; "style=" width:300px;height:166px; "src=" http://s1.51cto.com/wyfs02/M01/82 /04/wkiol1dhymlacnddaadezutqike849.png "title=" d925b1c2-7cb4-41c4-acd1-a6959b52e843.png "border=" 0 "vspace=" 0 " Width= "height=" 166 "hspace=" 0 "alt=" wkiol1dhymlacnddaadezutqike849.png "/>
Configuration file:
[Email protected]/]# cd/etc/samba/[[email protected] samba]# lslmhosts smb.conf smbusers
Users of Samba: 1. System user 2. The password is independent and not set the password for the password in/etc/shadow smbpasswd-a username
[[email protected] ~]# smbpasswd -helpwhen run by root: smbpasswd [options] [username]otherwise: smbpasswd [options] options: -l local mode (must be first option) -h print this usage message -s use stdin for password prompt -c smb.conf file use the given path to the smb.conf file -D LEVEL d ebug level -r machine remote machine -u user remote usernameextra options when run by root or in local mode: -a add user -d disable user -e enable user -i interdomain trust account -m machine trust account -n set no password -W use stdin ldap admin password -w PASSWORD ldap admin password -x delete user -R ORDER name resolve order
Set user password: (try to be inconsistent with the operating system)
[[email protected] ~]# smbpasswd-a sambanew SMB password:retype new SMB password:added user Samba.
[[Email protected] home]# CD Samba/[[email protected] samba]# Ls[[email protected] samba]# touch a
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/82/04/wKioL1dHyr6he8y5AAEr3W-Iyto568.png "title=" D620af71-f85d-4eba-9778-90587f7f7ad5.png "alt=" Wkiol1dhyr6he8y5aaer3w-iyto568.png "/>
[[email protected] samba]# lltotal 4-rw-r--r--1 root root 0 may 10:12 a-rwxr--r--1 Samba Sherry 3 could be 10:13 b.t Xt
The above default Access home directory
Configuration file Explanation:
[[Email protected] samba]# cp smb.conf{,.bak}[[email protected] samba]# vim smb.conf[global] workgroup = WORKGROUP server string = samba server version % v netbios name = sherry # The host name displayed on Windows will be capitalized; interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 # Monitoring Interface ip Nic Network; hosts allow = 127. 192.168.12. 192.168.13. # Monitor Host log file = /var/log/samba/log.% m # log %m variable substitution user name max log size = 50 # each log 50kb exceeds the scroll log security = user #user based on user share anonymous server account password centralized management The latter two deprecated passdb backend = tdbsam # Password Save method load printers = yes # Printer cups options = raw # Generic Raw mode [homes] comment = Home Directories browseable = no writable = no #家目录不让写; valid users = %s; valid users = MYDOMAIN\%S# define a shared directory [node1] comment=shared node1 path=/sambashared/ node1 # Login user has permission to do this directory writable = yes #所有用户进程写权限; write list = samba ,user2 #进程能写白名单 do not open together with the above Set up group; with @groupname +groupname browseable = no #不在白名单中的用户对此目录是否能够显示; guest ok = yes # users who are not on the whitelist are able to access ; read only=yes #只读; writable=no# can write and read Only one can be
A configuration file defines a shared directory:
[Node1] comment=shared node1 path=/sambashared/node1 writable = yes Write list = Samba
Test the configuration file syntax and display the final configuration:
[[email protected] node1]# testparm load smb config files from / etc/samba/smb.confrlimit_max: increasing rlimit_max (1024x768) to minimum windows limit (16384) processing section "[Homes]" processing section "[Printers]" processing section "[Node1]" Loaded services file ok. Server role: role_standalonepress enter to see a dump of your service definitions[global]server string = samba server version %vlog file = /var/log/samba/log.%mmax log size = 50client signing = requiredidmap config * : backend = tdbcups options = raw[ Homes]comment = home directoriesbrowseable = no[printers]comment = all printerspath = /var/spool/sambaprintable = Yesprint ok = yesbrowseable = no[node1]comment = shared node1path = /sambashared/node1write list = sambaread only = no
Linux client:
[Email protected] node1]# yum-y install samba-client
Log in
[[email protected] node1]# smbclient //sherry/ Node1 -u sambaenter samba ' s password: domain=[workgroup] os=[unix] server=[ samba 3.6.23-35.el6_8]smb: \> put anaconda-ks.cfg putting file anaconda-ks.cfg as \anaconda-ks.cfg (249.4 kb/s) (average 249.4 kb/s) SMB: \> get agetting file \a of size 0 as a (0.0 KILOBYTES/SEC) (average 0.0 kilobytes/sec)
Server:
[[email protected] node1]# lltotal 4-rw-r--r--1 root root 0 may 11:33 a-rwxr--r--1 Samba Sherry 1277 May 27 11: Anaconda-ks.cfg
Client mounts to Local:
[email protected] samba]# Yum install cifs-utils-y
[[email protected] samba]# mount-t cifs//sherry/node1/mnt/samba/node1/-o Username=samba # username=samba,passwd=2222 Password: [[email protected] node1]# df-hfilesystem Size used Avail use% mounted On.......//sherry/nod E1 1004M 18M 936M 2%/mnt/samba/node1
Over
Samba Service Configuration Detailed