Installation configuration and use of samba in Ubuntu14.04 in VMS

Source: Internet
Author: User
Tags ftp commands ftp client using git git clone

Used to be in the Redhat to build samba, now change to build on ubuntu12.04 found Sudo/etc/init.d/samba restart always not, originally, now under Ubuntu, start service to use sudo service smbd re Start, all changed to the service this form to start.

1. First install Samba

sudo apt-get install Samba

2, create a folder, this folder is used to share, transfer, read and write the contents of the file.

Mkdir-p/home/cxw/share chmod 777/home/cxw/share

This assumes that your shared folder is the share directory in the user's home directory.

3, configure the Samba configuration file smb.conf, make a backup of the configuration file.

sudo cp/etc/samba/smb.conf/etc/samba/smb.conf_backup

sudo vim/etc/samba/smb.conf

Below please note that the knife is moved in the following places. (1) Please search to find#security = userPlace, and then replace it with the following lines

Security = User (preceded by # # #) Username map =/etc/samba/smbusers
This is a safe mode for samba servers with 5 security modes: Share, User, server, domain, and ads.        Used to accommodate different enterprise server requirements, which is user by default. (2) Please also search for [global]workgroup = MshomeChange into

Workgroup = Workgroup Display charset = UTF-8 Unix charset = UTF-8 dos charset = cp936

The following three lines are intended to prevent the occurrence of garbled Chinese catalogs.

(3) Next, skip to the last line under the configuration file (Command mode, press g) to add the following lines to the last side of the file, assuming that the user allowed access is: CXW. The share name of the folder is the/home/cxw/share set in the second step:

[Share] Comment = shared Folder with username and password (note information) path =/home/cxw/share (I use the general set as path =/is the entire root directory) # public = Yes (allow anonymous access) writable = yes (writable)
# readyonly = yes (read-only) Valid users = cxw (user name, device accessible group available valid users [email protected] Group name) Create mask = 070 0 Directory mask = 0700 force user = nobody force group = Nogroup available = yes brows Eable = Yes (indicates visible hidden)

(4) Now add CXW to this network access account. If this account is not currently present on the system, please use the following command if the user is added here: (assuming the user is CXW, the password is 123456)

sudo useradd cxw

Note that the above only adds cxw this user, but does not give the user the local login password. So this user will only be able to access from remote, cannot log on from native.        And Samba's login password may not be the same as the native login password. Now you want to add the network user's account:

sudo smbpasswd-a cxw sudo vim/etc/samba/smbusers
Add the following line to the newly created file and save Cxw = "Network username"

(5) test and start samba sudo testparm pay attention to the old command.Sudo/etc/init.d/samba RestartWill definitely prompt sudo:/etc/init.d/samba:command not found please use the following command:

sudo service smbd Restart sudo service nmbd restart



How to exchange visits to samba between different systems.

1. If you just want to copy something, then I say there is no need to build so complex, you can fully use SSH.
sudo apt-get install SSH
2. If you are updating your repository in real time, samba may disappoint you, but Samba is a simple repository for temporary shared files, and it does not have the functionality of a version controller. To use the version controller, it is recommended to use SVN or git,walfred once wrote a simple article about Git, you can refer to using GIT to build a remote repository, let others git clone down


I. Access to Ubuntu-built samba under Windows. It should be the simplest.

Just use Win+r to bring up the explicit box, then enter \ \ IP with Samba's Ubuntu machine.

Second, the following key points under Ubuntu and Ubuntu share files.

Method 1: Use Smbclient

The host with Samba must have already installed samba.        Other clients also need to install Samba.        After sudo apt-get install samba SMBFS installation OK, then formally start using Smbclient. (1), list the shared folders provided by an IP address smbclient-l 198.168.0.1-u Username%password (2), using smbclient SMBCL like an FTP client Ient//192.168.0.1/tmp-u Username%password Executes the smbclient command successfully, enter the smbclient environment and a prompt appears:smb:\>There are many commands similar to FTP commands, such as CD, LCD, GET, megt, put, mput, and so on. With these commands, we can access the shared resources of the remote host.

Method 2: Mount with Mount

In addition to using smbclient, you can also mount and Smbcount remote shared folders on this side you need to use your fstype, so it is necessary to apply for the original Apt-get install SMBFS. Mount-t smbfs-o username=administrator,password=123456//192.168.0.1/tmp/mnt/tmp smbmount//192.168.0.1/tmp/ Mnt/tmp-o Username=administrator

Installation configuration and use of samba in Ubuntu14.04 in VMS

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.