Install the Samba server on ubuntu9.10

Source: Internet
Author: User

Before explaining how to install the Samba server on ubuntu9.10 (similar to other versions of ubuntu), we should first introduce Samba knowledge.

 

[1. Samba knowledge ]:

Since the advent of the NetBIOS protocol, Microsoft has used it to implement the network file/print service, which is a well-known printing and sharing service. It is based on the SMB (Server Message Block) protocol, allows different computers to share printers, serial ports, and abstract communication (such as Named Pipes and mail slots ). With the popularity of the Internet, Microsoft wants to extend this Protocol to the Internet, which is a standard for computers on the Internet to share data with each other. Therefore, it sorts out the existing SMB protocol with few technical documents, renames it CIFS (Common Internet File System), and intends to disassociate it from netbios, try to make it a standard protocol on the Internet.
To allow windows to share resources on UNIX hosts, one feasible method is to install software that supports SMB/CIFS on UNIX computers, so that the Windows client does not need to change the settings, like Windows hosts, resources on UNIX computers can be used. Samba is a software used to implement SMB. its working principle is to run the NetBIOS (Network Basic Input/Output System) and SMB protocols on the TCP/IP protocol, in addition, the netbeui (Net BIOS Enhanced User Interface) Protocol of Windows enables Unix-like hosts to be seen by Windows hosts on network neighbors. Its functions include: A. file sharing between Linux Hosts and Windows hosts; B. printer sharing between Linux Hosts and Windows hosts.

Now that we have such a good tool, we can share resources on the Virtual Machine ubuntu9.10 on XP, and give embedded Linux developers who are more accustomed to Windows operations (like me) it brings greater convenience.

 

[2. install and configure the Samba server in Ubuntu]

2.1 First, install the Samba server software:

Sudo apt-Get install samba <br/> sudo apt-Get install smbfs

 

 

2.2 next, configure the Samba server. Assume that the file you want to share is/home/reille (this is the reille directory of the user on Ubuntu ).

If you do not have this shared folder, you need to create it first. If you do not have this folder, you do not need to use it and then change its permissions:

Mkdir/home/reille <br/> chmod 777/home/reille <br/>

 

 

2.3 back up and edit smb. conf and configure it to require user password access:

2.3.1: Sudo CP/etc/samba/smb. conf/etc/samba/smb. conf_backup <br/> sudo gedit/etc/samba/smb. conf

 

2.3.2:

Search for the following line of text:

; Security = user or # Security

(In the smb. conf file, both; and # indicate comments)

Then, replace the following rows:
Security = user <br/> username map =/etc/samba/smbusers

 

2.3.3:

Add the following lines to the end of the file, assuming that the user allowed to access is SMB. The shared folder name is samba_share.

[Samba_share] <br/> comment = shared folder with username and password <br/> Path =/home/reille <br/> Public = Yes <br/> writable = Yes <br/> Valid users = SMB <br/> Create masks = 0777 <br/> directory mask = 0777 <br/> Force user = Nobody <br/> force group = nogroup <br/> available = Yes <br/> browseable = Yes

 

These two rows

Create mask = 0777 <br/> directory mask = 0777

Indicates that you can create files and directories in the shared folder when accessing this shared folder.

 

2.3.4:

Change the value here by the way. Find [Global] and change workgroup = workgroup

Workgroup = mshome <br/> display charset = UTF-8 <br/> UNIX charset = UTF-8 <br/> dos charset = cp936

The first line is the working group in which your windows instance is located. make changes to your computer.

The following three lines are used to prevent Chinese directory garbled characters. Depending on your local, the UTF-8 may need to be changed to cp936. Do it yourself.

 

2.4:

Now you need to add the network access account SMB. If this account does not exist in the system

Sudo useradd SMB

Note that the user SMB is added, but the user is not given a local logon password. Therefore, this user can only access it remotely and cannot log on from the local machine. In other words, there is no SMB folder in the/home directory. In addition, the samba logon password can be different from the local logon password.

 

2.5:

Add a network user account:

Sudo smbpasswd-a SMB <br/> sudo gedit/etc/samba/smbusers

Add the following line to the newly created smbusers file and save it:
SMB = "Network username"

 

2.6:

If you need to change newsfan's network access password in the future, use this command to change it:

Sudo smbpasswd-a SMB

If you want to delete the account of a network user, change-a in the preceding command to-X.

 

2.7:

Finally, log out and log on again or restart the machine:

Sudo/etc/init. d/samba restart

 

[3. Verify that the Samba server is successfully installed]

After configuring and re-logging in or restarting, you can verify that the samba service is successfully installed.

My ubuntu9.10 IP address is 192.168.1.125

Run the following command for verification:

Smbclient-l // 192.168.1.125-u SMB

If the installation is successful after you enter the password and log on, the following message is displayed:

Enter SMB's password: <br/> domain = [mshome] OS = [UNIX] Server = [Samba 3.4.0] </P> <p> sharename type comment <br/> --------- ---- ------- <br/> Print $ disk Printer Drivers <br/> share disk shared folder with username and password <br/> IPC $ IPC Service (Ubuntu server (Samba, UBUNTU )) <br/> domain = [mshome] OS = [UNIX] Server = [Samba 3.4.0] </P> <p> server comment <br/> --------- ------- <br/> Ubuntu ubuntu server (Samba, UBUNTU) <br/> WWW-BB0415062B9 guoyirong </P> <p> workgroup master <br/> --------- ------- <br/> mshome WWW-BB0415062B9 <br/>

You can also go to Windows and enter the following in the address bar of the folder interface:

 // 192.168.1.125

Enter the shared folder of Ubuntu and you will see the folder we want to share: samba_share.

 

 

4. Map the shared Ubuntu folder samba_share to a network drive]

In Windows, you can map the shared Ubuntu folder samba_share to a network drive. In this way, you can access the shared folder as you access drive C and drive D.

4.1:

On the desktop, right-click my computer, select [image network drive (n)...] from the menu, and select the drive name and shared folder path .. This is easy to describe...

 

 

 

 

 

 

 

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.