Operating environment: CentOS 6.5 64bit
What is the shared file between Linux and Linux between--nfs,windows and Windows-the shared Files feature is OK, and between Windows and Linux?
This is what this paragraph is going to say--samba.
Check if Samba is installed
# rmp -qa|grep samba
If it is installed, it will show a demo sample such as the following,
samba4-libs-4.0.0-58.el6.rc4.x86_64samba-common-3.6.9-168.el6_5.x86_64samba-winbind-3.6.9-168.el6_5.x86_64samba-client-3.6.9-168.el6_5.x86_64samba-3.6.9-168.el6_5.x86_64samba-winbind-clients-3.6.9-168.el6_5.x86_64
Otherwise. Use
# yum install smaba
Install Samba.
Configure Samba
Set boot up
# chkconfig smb on# chkconfig nmb on
You can also use the Setup command to configure the boot-up service via the interface.
# setup
New SMB user to access Linux shared files
# useradd smb # 新建用户# smbpasswd -a smb # 改动password
At this point, the/home folder will add an SMB user. The Linux User folder will be shared directly under Windows. To share additional files, follow the steps 3 configuration file.
If not, it is also possible to delete an SMB user.
# smbpasswd-x SMB # Remove SMB user
Samba configuration file.
[tmp]comment = Tmp Directoriespath = /tmp # 共享的Linux文件夹public = no # 文件夹不公开writeable = yes # 可写browseable = yes # 可读valid users = smb # 訪问用户。上面新建的,也能够使用原来已有的
Let Smaba through the firewall
The use of Samba requires a firewall, so there are 3 ways to do this, depending on the situation:
Method 1
# system-config-firewall
Method 2
Configure the/etc/sysconfig/iptables file. Join
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
Agree 139 445 137 138 several ports passed. Restart the firewall after the configuration is complete.
#/etc/rc.d/init.d/iptables restart
Method 3
Just shut down the firewall,
# service iptables stop # 临时关闭# chkconfig iptables off # 永久关闭
Turn off SELinux
# vim /etc/selinux/configSELINUX=permissive
You need to restart the system at this time,
# reboot
Start Samba
# service samba start # 启动# service samba restart # 重新启动
To pass
# service samba status
View the Samba boot status.
Windows interview
First look at the Linux virtual machine network IP address,
# ifconifgeth0 Link encap:Ethernet HWaddr 00:0C:29:FD:DC:43 inet addr:192.168.56.58 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fefd:dc43/64 Scope:Link
Use Win+r to open the execution form under Windows, enter
\\192.168.56.58
You can access the Linux shared folder.
Use this
# smbstatus
View the connection status.
File access permissions:
If you cannot copy files from Windows to a shared folder, you may be able to change the Dir folder permissions by using chmod 777-r dir in Linux because the shared folder has insufficient write permissions to the SMB user.
Because of permissions reasons, the/TMP folder is shared in this article because the/tmp folder is more open to all users.
References
- http://www.livingelsewhere.net/tag/unix-linux-samba-ftp-smb-cifs/
- Http://www.tangrucheng.com/centos6-5-setup-configure-samba.html
CentOS configuration Smaba sharing files with Windows