CentOS configuration Smaba sharing files with Windows

Source: Internet
Author: User

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 be displayed as follows.

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
  1. 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

  2. New SMB user to access Linux shared files

    # useradd smb       # 新建用户# smbpasswd -a smb  # 修改密码

    At this point, the/home directory will add an SMB user. The Linux User directory will be shared directly under Windows. To share additional files, follow step 3 to configure the file. If not, it is also possible to delete the SMB user,

    # smbpasswd-x SMB # Remove SMB user  
  3. Samba configuration file.

    [tmp]comment = Tmp Directoriespath = /tmp                         # 共享的Linux目录public = no                         # 目录不公开writeable = yes                     # 可写browseable = yes                    # 可读valid users = smb                   # 访问用户,上面新建的,也可以使用原来已有的
Let Smaba through the firewall

Using samba requires passing through 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, add

    -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

    Allow 139 445 137 138 several ports to pass. 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 # 重启

can be done by

# service samba status

View the Samba boot status.

Windows access

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

Using Win+r to open the Run window under Windows, enter

\\192.168.56.58

To access the Linux shared directory.

Use this

# smbstatus

View the connection status.

File access rights:

If you cannot copy files from Windows to a shared directory, you may be able to change the dir directory permissions by using chmod 777-r dir in Linux because the shared directory has insufficient write permissions to the SMB user. Because of permissions reasons, the/TMP directory is shared in this article because the/tmp directory is more open to all users ' permissions.

Reference
    1. http://www.livingelsewhere.net/tag/unix-linux-samba-ftp-smb-cifs/
    2. http://www.tangrucheng.com/centos6-5-setup-configure-samba.html
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.