Samba service configuration in CentOS

Source: Internet
Author: User
The Samba service configuration in CentOS is based on various tutorials on the network. However, you have modified the configurations based on your actual situation. Although www.2cto.com is simple, I believe that good memory is not as good as a bad pen. record it first to make it easy for you and yourself. Samba is Li...
The Samba service configuration in CentOS is based on various tutorials on the network. However, you have modified the configurations based on your actual situation. Although www.2cto.com is simple, I believe that good memory is not as good as a bad pen. record it first to make it easy for you and yourself. Samba is a common method for network sharing between Linux and Windows. Once configured, Windows users can access the shared directory of the Linux server for cross-system file transfer. Samba is more flexible and convenient than FTP. The following two methods are provided to configure the Samba server in CentOS. For personal research, use method 1. for formal development, see method 2. ■ Method 1: confirm the rpm to be installed with no user restrictions (insecure): 1 www.2cto.com ~ # Rpm-qa | grep samba2samba-client-3.5.10-114.el6.i6863samba-3.5.10-114.el6.i6864samba4-libs-4.0.0-23.alpha11.el6.i6865samba-winbind-3.5.10-114.el6.i6866samba-winbind-clients-3.5.10-114.el6.i6867samba-common-3.5.10-114.el6.i6868 # if not, you need to reinstall first set an ip for linux, and windows is a network segment of 1 www.2cto.com ~ # Mkdir/share --------------- create a folder under the root directory (except for the root directory, no other folder can be created) 2 ~ # Chmod 777/share/------------ assign permissions to the share Folder 3 ~ # Vi/etc/samba/smb. conf ------------ (edit smb under samba. conf file) edit security = share ---------- edit the last 58th [weihaiyang] 286 comment = share 287 path =/share 288 valid users = nobody 289 public = yes 290 writable = yes 291 printable = no 293 create mask = 0765 (the preceding number is the number of rows) 1 www.2cto.com ~ # Service smb restart # restart the smb service and enter the \ ip address of linux in "running" in windows. ■ Method 2: user authentication method (CentOS 6.2) (secure, applicable to production environments) 1. to configure the firewall to use the Samba server, open the following Port: UDP 137 UDP 138 TCP 139 TCP 445 1 # vi/etc/sysconfig/iptables # configure the firewall Port 2-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 139-j ACCEPT3-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 445-j ACCEPT4-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 137-j AC CEPT5-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 138-j ACCEPT6 www.2cto.com 7 ~ # Service iptables restart # restart the firewall. 2. check whether the Samba package has been installed ~ # Rpm-qa | grep samba2samba-winbind-clients-3.5.10-114.el6.x86_643samba4-libs-4.0.0-23.alpha11.el6.x86_644samba-client-3.5.10-114.el6.x86_645samba-common-3.5.10-114.el6.x86_64 indicates Samba has been installed, if not, run the following command 1 ~ # Rpm-ivh samba-3.5.10-114.el6.x86_64.rpm2 samba4-libs-4.0.0-23.alpha11.el6.x86_64.rpm3 samba-client-3.5.10-114.el6.x86_64.rpm4 samba-common-3.5.10-114.el6.x86_64.rpm5 samba-winbind-3.5.10-114.el6.x86_64.rpm6 samba-winbind-clients-3.5.10-114.el6.x86_64.rpm www.2cto.com the command above the does not wrap when actually executed, please complete 3. configure Samba 1 ~ # Chkconfig smb on # set samba to start 2 ~ # Service smb start # start the Samba service 3 ~ # Service smb restart # restart the Samba service 4 ~ # Service smb stop # stop the Samba service backup configuration file: 1 ~ # Cp/etc/samba/smb. conf/ete/samba/smb. confbak edit the configuration file: 01 ~ # Vi/etc/samba/smb. conf02 [global] # locate this line and configure the global tag, in this line, the following foreground content 03 www.2cto.com workgroup = WORKGROUP # Change the workgroup name to the WORKGROUP name defined by Windows network 04 server string = Samba Server # set the host name of the Samba server 05 security = user # set the Samba server security level to user, that is, access 06 by account and password # add the following custom content at the end of the configuration file 07 [SambaServer] 08 comment = SambaServer # Name of the shared directory seen in the Windows network neighbor 09 path =/home/SambaServer # location of the shared directory in the system 10 public = no # unpublished directory 11 writable = yes # The shared directory can read and write 12 valid use Rs = SambaUser # only allows the SambaServer user to access and save the configuration. 4. the SambaServer user directory of the account accessing the Linux shared directory is/home/SambaServer, and the user login terminal is set to/bin/false (so that the user cannot log on) 1 www.2cto.com ~ # Cd/home2 ~ # Mkdir SambaServer3 ~ # Cd SambaServer4 ~ # Touch samba.txt # Create a test file 5 ~ # Useradd SambaServer-d/home/SambaServer-s/bin/false6 ~ # Chown SambaServer: SambaServer/home/SambaServer-R 5. add the user SambaServer to the Samba user database, and set the logon password to 123456 view sourceprint? 1 ~ # Smbpasswd-a SambaServer2New SMB password: # enter the password used by the user to log on to Samba. 3 Retype new SMB password: # enter the password again. 4 Added user SambaServer5 # note: the password set here is the password used to log on to the Samba shared directory. it is not the password used to log on to the Linux system www.2cto.com 6. restart Samba service 1 ~ # Service smb restart 7. enter \ ip or \ Samba Server # Server name in Windows client access and press enter. the login box is displayed. enter the username: SambaServer and Password: 123456 to access the shared directory. In CentOS, the Samba server configuration is complete. By Kevin Xin
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.