One. Window host access to a directory shared by the Samba service by a Linux host
1. Test environment
Physical Host: Win8
Virtual Host: Rhel 5.8
Network mode: Bridging
Installation mode install Samba with a locally configured Yum source
The SELinux is off
2. Configure the Yum source
Mount-r/dev/cdrom/media/cdrom//Mount disc image
3. First install samba3x samba3x-client Samba3x-common Samba3x-swat
Yum-y Install samba3x samba3x-client Samba3x-common Samba3x-swat
4. Create a user on the virtual host
[[email protected] ~]# groupadd-g 2532 hadoop[[email protected] ~]# useradd-g 2532-u 2532 hadoop[[email protected] ~]# ID hadoopuid=2532 (Hadoop) gid=2532 (Hadoop) groups=2532 (Hadoop) context=root:system_r:unconfined_t: Systemlow-systemhigh
5. Start Samba Services
Service SMB Start
6. Create a shared directory (on a virtual host)
Mkdir/source
7. Add configuration information for the shared directory in the/etc/samba/smb.conf configuration file
It's best to back up a copy of the smb.conf file
[Source]
Comment = Source
Path =/source
Public = yes
writeable = yes
8. Test smb.conf file syntax for errors
Testparm
9. Add Hadoop to the Samba user account
[[email protected] samba]# smbpasswd-a hadoopnew SMB password:retype new SMB password:added user Hadoop.
10. Remember to restart the Samba service after modifying the configuration file
[[Email protected] samba]# service SMB restartshutting down SMB services: [OK]starting SMB services: [OK]
11. Access the share through a UNC path on the window
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/02/wKioL1XyPAjDHycfAABydoMd1jI088.jpg "title=" 2.png " alt= "Wkiol1xypajdhycfaabydomd1ji088.jpg"/>
12. Add Write permissions for Hadoop users in the shared directory
[Email protected] source]# setfacl-m U:hadoop:rwx/source
13. Map a shared directory to a network drive
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/05/wKiom1XyOzfw2Zc8AABEYlku2cc467.jpg "title=" 4.png " alt= "Wkiom1xyozfw2zc8aabeylku2cc467.jpg"/>
14. Add Samba to the list of services and let it boot automatically
[[email protected] lamp]# chkconfig--add smb[[email protected] lamp]# chkconfig--list | grep smbsmb 0:off1:off2:off3:off4:off5:off6:off[[email protected] lamp]# chkconfig--level 345 SMB On[[email PR Otected] lamp]# chkconfig--list | grep SMBSMB 0:off1:off2:off3:on4:on5:on6:off
Two. Linux hosts mount Windows host shared directory to local
1. First create a shared directory on the window host (very simple)
2. Access this share via Smbclient on a Linux host
[Email protected] source]# smbclient//192.168.x.x/share-u wuser
3. Mount the server-side shared directory to a local
[Email protected] source]# mount-t cifs//192.168.x.x/source/mnt-o username=hadooppassword: [[email protected] source] # Cd/mnt[[email protected] mnt]# ls-a. .. BusyBox cache CVS Iptables lamp rsync+inotify tomcat[[email protected] mnt]#
4. Boot automatically mount shared directory, edit/etc/fstab
192.168.1.106/source/mnt CIFS credentials=/etc/samba/cred.passwd 0 0
5. Create the/etc/samba/cred.passwd file with the following content:
Username=hadoop
Password=hadoop
6. Modify permissions to only let administrators have permission to view cred.passwd files
[Email protected] samba]# chmod og=---/etc/samba/cred.passwd [[email protected] samba]# lltotal 56-rw-------1 root root Sep 10:48 cred.passwd-rw-r--r--1 root root 5 Jan lmhosts-rw-r--r--1 root root 9890 Sep one 10:03 SMB . conf-rw-r--r--1 root root 9778 Sep one-09:58 smb.conf.bak-rw-r--r--1 root-root + Jan 5 smbusers
Three. How Samba implements IP access control
1. Add a whitelist to the/etc/samba/smb.conf file
Hosta allow = 192.168. 192.168.10.192.168.10.100
Four. Samba3x-swat (Samba graphics configuration program, Port 901)
1. Start the XINETD service
[[Email protected] lamp]# service xinetd start
2. Turn on monitoring
Chkconfig SWAT on
The service will not listen until it restarts
Service xinetd Restart
Or directly modify the contents of the file/etc/xinetd/swat
Disable = no
Accessed via Ip:port in the browser, the first access requires the root user password to be entered
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/08/wKiom1XySc3QBBKPAAGFDyJ722M136.jpg "title=" 3.png " alt= "Wkiom1xysc3qbbkpaagfdyj722m136.jpg"/>
This article is from "Luo Chen's blog" blog, please be sure to keep this source http://luochen2015.blog.51cto.com/9772274/1693773
Windows host access to Linux hosts shared directories through Samba services and Linux hosts mount Windows host shared directory to local