Share directories between Ubuntu systems and Win7 systems using Sambaserver

Source: Internet
Author: User

1 Introduction

Today is the era of networking, each of us to better development. Without the support of network and informationization. Take advantage of network support. Sharing information among different operating systems is an essential skill for computer majors.

This article is about how to establish, set up, link sambaserver, so that in the network of two computers, one is installed Ubuntu operating system, one installed is Win7, through the form of shared directory to share information. The location and network architecture of the two computers on the network are seen in Figure 1.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvum9izxj0q2hlbkd1yw5nemhp/font/5a6l5l2t/fontsize/400/fill/ I0jbqkfcma==/dissolve/70/gravity/center ">

in figure 1 Two computers in fact their physical location is next to me, just because of the physical rj47 port too few, just let the desktop connected to the rj47 port". My laptop is connected to the network via a wireless router. To facilitate the exchange of documents and information between the two computers. I just want to do this with a shared directory.

Let's say both computers are Windows -friendly. But now one is Ubuntu System, a Win7 System, how to realize the function of shared directory? based on the references [1]. With SambaServer, I have implemented this feature smoothly. Please see below for a detailed description.

2 Creating and configuring a Sambaserver

Because of the ability to share directories between Ubuntu systems and Win7 systems on the Web, Sambaserver is a server that supports functions such as file interaction with Windows systems on Ubuntu systems. Our idea is to create a sambaserver on the desktop and the Win7 system to access the shared directory on the server in the client's way. This is the directory on the Utuntu system. Samba, which appeared in 1992, was originally designed to facilitate the sharing of files between UNIX systems and Windows systems, but this was not the only thing. It also supports interactive sharing of files between different systems, such as Ubuntu on Ubuntu. Mac OS to Mac OS and so on.

2.1 Installing Sambaserver

Suppose you are using Ubuntu Server distribution, which itself will be preinstalled and you can skip this step. Go directly to the next step. Assuming you're using an ordinary Ubuntu distribution, it's not installed by itself and requires you to install Samba first. You can install Samba graphically from Ubuntu Software Center, and you can install it as a terminal command. The commands installed in the terminal mode are as follows:
sudo apt-get install Samba
sudo apt-get install Smbfs

2.2 Identify a directory to be shared on the Ubuntu system

This directory can be a pre-existing directory. If you want to keep the shared directory from being confused with your other directories, it's a good idea to create a separate directory to be used exclusively for sharing. Use the following terminal command to create a directory to share and give it read and Write permissions:
sudo mkdir/home/share
sudo chmod 777/home/share

2.3 Edit smb.conf File

In order for other computers on the network to visit Sambaserver in the client's way, the first thing you do is to configure the/etc/samba/smb.conf file. This configuration file is similar to the INI file under Windows, allowing administrators to configure information about the server. Please follow the steps below:

1. Open the smb.conf file with an editor.

Because the file requires permission to change the ability. Do not use direct click to open, it is best to use the command sudo vim/etc/samba/smb.conf or sudo gedit/etc/samba/smb.conf way to open.

2. Find the content below [global] workgroup = Workgroup in front of the semicolon (the;) is removed (the semicolon starts with a gaze) and adds content behind it, finally becoming

Workgroup = Workgroup
Display CharSet = UTF-8
Unix CharSet = UTF-8
DOS charset = cp936

3. Locate the security = User line, remove the semicolon in front of it, and add the content after it, and finally become:
Security = User
Username map =/etc/samba/smbusers

4. Add the directory you want to share to the Sambaserver and specify the user who will consent to the interview. By following this, add the following to the end of the file (of course, you can also set it through the graphical Samba Configuration Manager.) Set, in this document will be self-evident.

):
[Share] The name to be shared under the//windows system
Comment = Test whether the method is good//gaze that you use to share the gaze of the join. Be able to provide the purpose of sharing
Path =/home/share//Previous steps established on Ubuntu System for shared directories
Public = yes
writeable = yes
Valid users = Chgzhi//access to Sambaserver user, but it must be another Ubuntu user, and at the same time must be a separate one from the password of the Ubuntu system, of course you can make them consistent.
Create mask = 0700
Directory mask = 0700
force user = Nobody
Force Group = Nogroup
Available = yes
browseable = yes

5. Save and exit the editing process for the file.

2.4 Defining access for Samba users password

Note that only the users who are legally present in the Ubuntu system will be able to act as sambaserver users. Now assume that your Ubuntu system already has a user Chgzhi, which is exactly the user we set in the previous section (Valid users = Chgzhi). What we are going to do now is to set the corresponding password for the user to change. The assumption is that the initial setup password uses the following command:

sudo Smbpasswd-achgzhi
Suppose you have previously set this password, remove the parameter a.

2.5 Start Sambaserver again

Because the server has just been configured again. At this point we'd better start the server again. The commands used are as follows:
sudo service smbd restart

3 Shutting down the firewall

Because Ubuntu system is in the server position, so we just need to shut down the Ubuntu system firewall can, for the WIN7 system firewall does not need to shut down. Commands such as the following:
sudo ufw disable
At this point, the server side of the work we need to do has been completed. The next step is to use the client to connect to the shared directory.

4 Client Connection

4.1 Smbclient client Program

This is a client command-line program that comes with the Samba server program. It supports access to another Ubuntu system where samba is installed. Here we use it to test the success of the newly established server. For example, as seen in 2. We're just testing this, and we didn't use another computer to connect Sambaserver. As can be seen in Figure 2, we are connected successfully and entered the client interactive command prompt (SMB: \>), there are a variety of commands available for you to use, please refer to table 22-2 of page No. 535 of the literature [1]. The password entered in the figure when you use the method of section 2.4 to set up the password. I am already enjoying the convenience of the shared directory, Figure 2 is on the desktop Buntu system, and through the shared directory agreed to Win7 system access, and this writing is on the Win7 system.


Figure 2 Smbclient client program Demo sample

4.2 Using the WIN7 system to connect the Sambaserver in the form of a client

Access to the shared directory set up on the Ubuntu computer in a notebook with a Win7 system is very easy and does not require any client programs to be transferred.

1. Click MyComputer to appear in Figure 3. Then click on Map Network Drive in the figure, and then Figure 4 appears.


2. Enter the IP address of the Ubuntu machine and the shared directory name share in the folder text box in Figure 4.

Click Finish to appear in Figure 5.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvum9izxj0q2hlbkd1yw5nemhp/font/5a6l5l2t/fontsize/400/fill/ I0jbqkfcma==/dissolve/70/gravity/center ">

Figure 4 Win7 Connection schematic

3. Enter your Samba account in Figure 5, which is set up in section 2.4. Click OK button. The exciting moment is up. Connection succeeded, 6. You can freely share files between two different operating systems, enjoy the results of networking!


Figure 5 Win7 Connection---input sambausername and password


Figure 6 A shared directory of Samba servers connected under the WIN7 system share

5 Summary

This article describes the methods for sharing directory settings. The reader is required to have basic knowledge of Ubuntu usage, especially the use of terminal under Bash shell. [1] Introduction to basic usage of Ubuntu system, recommended books. The book is similar to the university freshman enrollment in the computer Culture Fundamentals course for Windows systems. But more useful.

I believe that this article describes the method is only one way, there must be a better way to share the directory.

If there is a better way for a reader, please enlighten me.

References
[1] Richard Blum. Ubuntu Linux Secrets. Wiley, Indianapolis, in, 2009.

Share directories between Ubuntu systems and Win7 systems using Sambaserver

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.