Used to be on the Redhat to build samba, now changed to build on the ubuntu12.04 found Sudo/etc/init.d/samba restart never, originally, now Ubuntu, start service to use sudo services smbd re Start, all changed into a service this form to launch.
1. Install Samba first
sudo apt-get install Samba
2, create a folder, this folder is used to share, transfer, read and write the contents of the file place.
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 following knives are being moved. (1) search for #security = user place, and replace it with the following lines
Security = User (preceded by a # number removed) Username map =/etc/samba/smbusers
This is a security mode for the Samba server, with 5 security modes: Share, User, server, domain, and ads. Used to accommodate different enterprise server requirements, which is user by default.
(2) also please search to [global] to Workgroup = mshome change to
Workgroup = Workgroup Display charset = UTF-8 Unix charset = UTF-8 dos charset = cp936
The following three lines are in order to prevent the occurrence of garbled Chinese directory.
(3) Next, skip to the last line under the configuration file (in command mode, press g) to add the following lines to the end of the file, assuming that the user allowed to access is: Cxw. The share name for the folder is the/home/cxw/share of the second step setting:
[Share] comment = Shared Folder with username and password (annotation information)
Path =/home/cxw/share (I use general settings for 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 =@ group name)
Create mask = 0700 Directory mask = 0700 force user = nobody force group = Nogroup Availab Le = yes browseable = Yes (indicates visible hidden)
(4) Now add CXW to this network access account. If the system does not currently have this account, then note that this side of the user add please use the following command: (assuming the user is CXW, password is 123456)
sudo useradd cxw
Note that the above only adds cxw to the user, but does not give the user the local login password. So this user will only be able to access from the remote and cannot log on from this computer. And Samba's login password can be different from the native login password. Now you want to add the account number of the network user:
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 notice that old commands don't work. Sudo/etc/init.d/samba Restart will definitely prompt sudo:/etc/in It.d/samba:command not found please use the following command:
sudo service smbd Restart sudo service nmbd restart
How to exchange the samba between different systems.
1. If you just want to copy things, then I say there is no need to build so complex that you can use SSH completely.
sudo apt-get install SSH
2. If you are updating your version of the library in real time, samba may disappoint you, Samba is simply a repository for temporary shared files and does not function as a version controller. To use a version controller, it is recommended that you use SVN or git,walfred once wrote a simple article about Git, you can refer to using GIT to build a remote warehouse, let someone else git down
First, access to Ubuntu-built samba under Windows. It should be the simplest.
Simply use the win+r to pull up the explicit box and enter the IP of the Ubuntu machine with Samba.
Second, the following focus on Ubuntu and Ubuntu under the sharing of files.
Method 1: Use Smbclient
The host built with Samba must have been installed with samba. Other clients also need to install Samba. sudo apt-get install samba SMBFS installation OK, then officially start using Smbclient bar. (1) Listing the shared folders provided by an IP address smbclient-l 198.168.0.1-u Username%password (2), which is used like an FTP client smbclient Smbclient//192.168.0.1/tmp-u username%password Execution smbclient Command succeeded, enter the smbclient environment, a prompt appears: smb:\> There are many lives here. Make and FTP commands similar, such as CD, LCD, GET, megt, put, mput and so on. With these commands, we have access to the shared resources of the remote host.
Method 2: Mount with Mount
In addition to using smbclient, you can mount and smbcount a remote shared folder 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