Samba implements simple linux and window file sharing

Source: Internet
Author: User

Samba implements simple linux and window file sharing

Requirement: the ms SQL database needs to be backed up in different regions. It was originally intended to provide rsync for synchronization from windows to linux, but the directory needs to be changed and scheduled tasks need to be set. The O & M of more than 90 machines is too lazy to adapt to new usage, as a result, samba is used to share files, so that they can be directly synchronized to the file server through the SQL server stored procedure.

Implementation:

File Sharing server: 10.10.10.9

1. Install samba

Yum install samba

Service smb start

Chkconfig smb on

2. Edit the configuration file

 

[Root @ caiji-9 samba] # vim/etc/samba/smb. conf [global] workgroup = MYGROUPserver string = Samba Server Version % vhosts allow = 10.log file =/var/log/samba/log. % m # max 50KB per log file, then rotatemax log size = 50 security = user # user mode for user name and password access; you can also encrypt passwords = yes # password encryption in share mode. The default value is yespassdb backend = smbpasswd # password background, encrypted with smbpasswd. tdb is also supported, smb passwd file such as ladmp =/etc/samba/smbpasswd # location of the password file encrypted by smbpasswd [caiji_bakcenter] # externally visible sharing name comment = caiji bak center # description path of the sharing module = /data/caiji_bak # actual path of the shared module browseable = yes # Share visible writable = yes # Share writable printable = nopublic = no # Share anonymously visible valid users = cancet # Share write list = writable et # users with writable permissions

3. Add a valid user

 

Because our password uses smbpasswd in the background, you can use smbpasswd to add users.

Smbpasswd-a packet et

After the password is entered, the smbpasswd password file is generated under/etc/samba.

Note: Because the guest et user does not exist in the linux system, smbpasswd-a guest et may fail.Such:

 

[root@caiji-9 samba]# smbpasswd -a datagetNew SMB password:Retype new SMB password:Failed to add entry for user dataget

Therefore, we need to first add the login et user to the linux system, useradd-s/sbin/nologin-d/dev/null Login et, so that the user cannot log in or have no home directory.

 

In addition, we need to change the owner or permission of the shared directory, chown login et. login et caiji_bak or chmod 777 caiji_bak

After the change is complete, enter \ 10.10.10.9 in cmd and enter the user name and password to log in.

Ps: 1 in windows, we can use net use \ 10.10.10.9 \ caiji_bakcenter "password"/user: IP \ "Account" to share files at the command line level.

2. This configuration is relatively simple and does not involve anonymous access and share mode in the user mode. I hope to give us a quick start to those who need this function.

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.