Windows samba for writing files to ubuntu

Source: Internet
Author: User

1: Install samba

sudo apt-get install samba smbfs smbclient

2: Modify/etc/samba/smb. conf

1. in the global settings section, security = user sets the samba security level. In Samba, you can set a total of four security registrations, from bottom to height: share indicates that anyone can log on without entering a password. This is the default Samba level. Each user must enter a password to log on. Server user-level passwords are stored on the local machine, while server-level passwords and user names are stored on another host. Domain level requires that a Windows domain Controller be in the network, and the verification is completed by the domain controller. Note that, as long as you enter the user name and password level, the user name must first be workgroup = MSHOME, a user in Linux, which is the Working Group of the Windows host, windows host must be in the same working group. The server string = % h server (Samba, Ubuntu) option is displayed on Windows and can be customized, here, % h is the variable in the Samba configuration file, representing the host name. That is, when the host name map to guest = bad user obtained by using the hostname command is security = user, this option must be commented out, for example: # map to guest = bad user2. Add a shared folder in the sharing Settings section and set the following [share] shared file name, it does not need to be consistent with the actual file name. comment = my share directory describes the shared branch path =/home/share system., Must be the absolute path public = yes whether everyone is allowed to see this directory, no is not able to see writable = yes whether users are allowed to write in this directory, no is not allowed, if writable, you also need to have the write permission in the directory read only = yes to set whether the user is read-only vaild users = username. only the username user is valid. SAMBA user management is valid when Password Logon is required. When setting the user password, this user must be a LINUX user, and the following command user must first be the System user sudo smbpasswd-a user. Then, enter the password twice as prompted. The parameters of the smbpasswd command are as follows: -a adds a Samba user. -D. disable a Samba user. -E: disables Samba users. Start the SAMBA service # Stop the SAMBA service sudo/etc/init. d/smbd stop # Start the SAMBA service sudo/etc/init. d/smbd start # restart sudo/etc/init. d/smbd restart access the shared directory in WINDOWS # Enter "192.168.1.10" in the resource manager or in a browser. The "192.168.1.10" command is testparm.

3: write files

        public void SmbTest()        {            try            {                /*                DataSet ds = new DataSet();                ds.ReadXml(@"E:\Test\Test\Test\163074.xml");                ds.WriteXml(@"\\10.53.132.52\share\012\a.xml");                 */                Directory.CreateDirectory(@"\\10.53.132.52\share\013");            }            catch (Exception ex)            {                Console.WriteLine(ex.ToString());            }        }

Next we will achieve this through FTP.

Chkconfig smb on # Set Samba to automatically start service smb start # start Samba
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.