Lab requirement: Set up a samba server under RHEL6.4 to share directories and data. Set the sharing name to "software" to deny anonymous user access. Only members of the manager group can access the file: vmwarevm Ubuntu dual-nic samba access speed doubled
Lab requirements:
Build a samba server in RHEL6.4
Share directory/data with the shared name of software
Anonymous access is denied. Only access from members of the manager group is allowed.
------------------------------------ Split line ------------------------------------
Reading:
VMWare Virtual Machine Ubuntu dual Nic samba access speed doubled http://www.linuxidc.com/Linux/2013-06/85445.htm
Samba File Sharing Server joining Windows Server 2003 domain http://www.linuxidc.com/Linux/2013-06/86391.htm
Samba installation configuration http://www.linuxidc.com/Linux/2013-06/86101.htm
Configuration http://www.linuxidc.com/Linux/2013-01/78390.htm for Samba services in CentOS 6.2
Graphic http://www.linuxidc.com/Linux/2013-01/78234.htm for building Win7 + VMware + Fedora18 Samba Server
------------------------------------ Split line ------------------------------------
1. install the software package on the server (192.168.100.1)
[Root @ samba-server Desktop] # yum-y install samba-common samba-client
2. Edit the main configuration file
[Root @ samba-server Desktop] # vim/etc/samba/smb. conf
......
74 workgroup = jin
75 server string = my fist file server
......
89 log file =/var/log/samba/% m. log // log file
...
91 max log size = 50
...
101 security = user
102 passdb backend = tdbsam
......
255 [software]
256 comment = software
257 path =/data
258 browseable = yes
259 public = no
260 writable = yes // writable
261 valid users = @ manager
262 write list = @ manager
[Root @ samba-server Desktop] # testparm // This command tests the main Configuration File Syntax
3. Create test users and groups and share Directories
[Root @ samba-server Desktop] # groupadd manager
[Root @ samba-server Desktop] # useradd-G manager obama
[Root @ samba-server Desktop] # useradd-G manager bush
[Root @ samba-server Desktop] # useradd sanmao // non-manager group member account
[Root @ samba-server Desktop] # echo 123456 | passwd -- stdin obama
[Root @ samba-server Desktop] # echo 123456 | passwd -- stdin bush
[Root @ samba-server Desktop] # echo 123456 | passwd -- stdin sanmao
[Root @ samba-server Desktop] # pdbedit-a-u obama // Add a shared account
[Root @ samba-server Desktop] # pdbedit-a-u bush
[Root @ samba-server Desktop] # pdbedit-a-u sanmao
[Root @ samba-server Desktop] # pdbedit-L // view shared users in the samba Library
Mr. obama: 503:
Bush: 504:
Sanmao: 505:
[Root @ samba-server Desktop] # mkdir/data
[Root @ samba-server Desktop] # touch/data/test.txt
[Root @ samba-server Desktop] # setfacl-m g: manager: rwx/data
[Root @ samba-server Desktop] # getfacl/data
Getfacl: Removing leading '/' from absolute path names
# File: data
# Owner: root
# Group: root
User: rwx
Group: r-x
Group: manager: rwx // confirm the permissions of the manager group
Mask: rwx
Other: r-x
4. Start the service
[Root @ samba-server Desktop] # service smb start
[Root @ samba-server Desktop] # service nmb start
[Root @ samba-server Desktop] # chkconfig smb on
[Root @ samba-server Desktop] # chkconfig nmb on
5. linux client Testing
[Root @ client ~] # Smbclient-U obama // 192.168.100.1/software
Enter bush's password:
Domain = [JIN] OS = [Unix] Server = [Samba 3.6.9-151. el6]
Smb: \> ls
. D 0 Wed Apr 16 08:50:29 2014
.. DR 0 Wed Apr 16 08:28:12 2014
Test.txt 0 Wed Apr 16 08:28:40 2014
63699 blocks of size 262144. 49537 blocks available // login successful
[Root @ client ~] # Mount-t cifs // 192.168.100.1/software/mnt-o username = obama // mount shared Disks
Mount: block device // 192.168.100.1/software is write-protected, mounting read-only
Mount: cannot mount block device // 192.168.100.1/software read-only // This error occurs because the cifs-utils package is not installed.
[Root @ client ~] # Yum-y install cifs-utils
[Root @ client ~] # Mount-t cifs // 192.168.100.1/software/mnt-o username = obama // re-mount
Password:
[Root @ client ~] # Ls/mnt
Test.txt
6. Use sanmao, a non-manager member, to test the linux Client
[Root @ client ~] # Smbclient-U sanmao // 192.168.100.1/software
Enter sanmao's password:
Domain = [JIN] OS = [Unix] Server = [Samba 3.6.9-151. el6]
Tree connect failed: NT_STATUS_ACCESS_DENIED // Logon failed
7. window client Test
Note: samba can be automatically mounted when you log on with the account and password, but the account and password will be exposed, which is generally not used.
Automatic mounting upon startup
Vim/etc/fstab
// 192.168.100.1/software/mnt cifs ults, username = username, password = password 0 0
How autofs triggers mounting
Vim/etc/auto. master
/Mnt/etc/auto. samba
Vim/etc/auto. samba
Samba-fstype = cifs, username = username, password = password: // 192.168.100.1/software
Service autofs restart
For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-05/101167.htm