[Android] Samba server configuration in Ubuntu and data sharing between Windows systems

Source: Internet
Author: User

Installing Samba

Installing Samba
sudo apt-get install Samba
Edit
Kubuntu

Sharing module for installing system settings
sudo apt-get install kdenetwork-filesharing
Edit
Configuration

1.windows access to Ubuntu

The first step is to create a shared directory: for example, to create a/home/user name/share first create this folder (this user name is your user name, in order to make it easy to understand I wrote, I remember to change AH)

Code:
mkdir/home/User name/share (new share folder)
chmod 777/home/User name/share (set permissions on this folder so that all users can read and write to run)

Backing up and editing smb.conf allows network users to access (develop a good habit of backing up at any time, and at the critical time you'll find out how smart the backup was!) Code
sudo cp/etc/samba/smb.conf/etc/samba/smb.conf_backup
sudo gedit/etc/samba/smb.conf

Search for this line of text code:
; Security = User

Replace them with the following lines

Code:
Security = User
Username map =/etc/samba/smbusers

Add the following lines to the last side of the file, assuming that the user allowed access is: new. and the folder's share name is Share # This is because we're going to create an SMB user new and let XP users use this new to communicate with us. Of course, you can write your favorite name just to be consistent.

Code:

[Share]

Comment = Shared Folder with username and password

Path =/home/User name/share

Public = yes

writable = yes

Valid users = new

Create mask = 0700

Directory mask = 0700

force user = Nobody

Force Group = Nogroup

Available = yes

browseable = yes

Then change this here and find [global] to change workgroup = Mshome to: (Note that the workgroup here is the workgroup name in the share) code:

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. Now you want to add the new network Access account. If this account is not currently present in the system, then

Code:

sudo useradd new
Note that the above only adds the new user, but does not give the user a native 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:

Code:

sudo smbpasswd-a new (Set your new password, this password is not used on the boot login time, is you want to access the win share file or the win share file to access your password when you want to fill) sudo gedit/etc/samba/smbusers
Add the following line to the newly created file and save

Code:

New = "Network username"

If you need to change the new network access password in the future, use this command to change

Code:

sudo smbpasswd-a new

The command to delete the network user's account change the top-A to-x sudo smbpasswd-x new

Test and restart Samba

Code:

sudo testparm

When you enter the above command, it is possible to "execute the child process" Testparm "failed without the file or directory" at this point you want to re-enter the command: Apt-get install samba-common-bin This problem can be resolved the input restart command: sudo/ ETC/INIT.D/SMBD restart

Well, to this simple Samba service cry is configured to open up your win next to the Network Neighborhood view workgroup computer There is a shared Samba service, but only if you have started Samba service

Registration: 2009-04-11 20:52 Posts: 147 Address: Beijing Jinsong sent thanks: 0 times receive thanks: 0 times
Win visit Ubuntu PostScript
Some people say I strictly follow the above operation, in their own Ubuntu system right-click a folder, point sharing, and then create a shared file, the results of the LAN under Win XP can see the shared folder, but it is not open! Why?
The reason is the permissions problem, if you share the/media/media/wallpaper This folder, you will immediately give this folder readable writable can be run permissions

Simple, so use.? Type FUSE-SMB FUSE-SMB has been aliased to "Smbmount//192.168.100.53/shared directory/~/fuse-mnt/-o Username=smb,password=ice,iocharset=utf8"
Edit
Ubuntu access to Windows xp/2003/2000 system

Here are four ways that the original author offers ... But I only stable success of the fourth kind, the kind of time when the spirit is not spiritual, and most people can only succeed fourth, do not know why ...

The first: With SMB access direct point-location-network-there is a Windows network, click to find the computer and files you want to find, then you may want to account and password, note that the account of the computer that was visited, not the new method of the previous build is the most convenient! But the success rate is not high

Second: Use the Ubuntu system to bring the connection to the server function access in the location to start connecting to the server, select "Windows Share" in the service type, enter the IP address or computer name of the Windows computer in the server, click Connect, This displays a file volume attached to the Windows computer in the system desktop. We can access it like a disk in the Ubuntu system, as well as enter the SMB username and password when accessing it. Often the first method does not succeed this also don't want to succeed

Third: Mount the Windows shared directory with mount to the local disk first to set up a mount point in the Ubuntu system, where we set up the hang at point for/mnt/wind also to ensure that the network connection is normal, and Windows has a shared directory under the premise of the operation With Windows IP 192.168.0.1, shared folder for share as an example

The command is as follows:

Mount-t Smbfs–o username=new,password=123456//192.168.0.1/share/mnt/wind

¥ I feel the success rate of this is higher than the previous two methods, one but the success of the load on the line

I also derived a method seems to be more feasible on my computer, that is to know the absolute address of the shared directory directly enter the absolute address

smb://intellectual/Movie 3/

Intellectual is his user name (not ip,ip useless) Movie 3 is one of his shared folders ~

Directly with smb://username/shared file name so that you can, in the access time will ask you that XP password then fill in it will also verify your SMB password This is used above you set that you can, anyway, I succeeded ¥

Sometimes this will be in the access to the problem of Chinese garbled, so we can follow the command to execute, can solve the problem

Mount-t Smbfs-o iocharset=uft8,codepage=cp936,clmask=777,fmask=777,userneme=wangyh,password=123456//192.168.0.1/ Share/mnt/wind

Note: Usename and password are both SMB users and passwords, if you want to learn more about the Mount command, use man mount to view detailed usage tips at the terminal: to access a folder with a special password in Windows, You can create a new user with the same password as the Windows login in Samba, then mount, for example:

sudo useradd administrator//Don't let it have permission to sign in to Ubuntu

sudo smbpasswd-a administrator

Then prompt for a password: Enter the password for Windows access
The fourth type: Use the smbclient command command as follows:

Smbclient//ip/The shared folder----your SMB account, which is the new

Example: Smbclient//218.196.119.86/Movie-u new password: Enter the password for the SMB user new

You can use the Enter to download the file with the command get, upload the file with put.

Annotations:

Smbclient Introduction:

Command description

? or Help [command] for help or a command

! [Shell command] executes the shell commands used, or lets the user enter the shell prompt

CD [directory] switches to the specified directory on the server side, if not specified, Smbclient returns the current local directory

LCD [directory] switch to the client-specified directory;

Dir or LS lists the files in the current directory;

Exit or quit Quit Smbclient

Get file1 file2 download file1 from the server and file2 on the local machine with the file name;

If you don't want to change your name, you can omit file2

Mget file1 file2 file3 filen download multiple files from the server;

MD or mkdir directory created on the server

Rd or RmDir directory deletes a directory on the server

Put File1 [file2] to the server to upload a file file1, to the server renamed to File2;

Mput file1 file2 Filen uploading multiple files to the server
¥ This method is not unexpected success, and this success again try to try the first two methods may be successful, in short, I feel this shared access when the spirit is not spiritual, hope that the future can improve ~
Edit
Wrong row
Edit
Garbled

How to handle the display garbled characters of the Chinese directory of the network neighbor: * Confirm your local, if: ZH_CN. UTF-8 the following:

In the/etc/samba/smb.conf [Global] segment plus:
Display CharSet = UTF-8
Unix CharSet = UTF-8
DOS charset = cp936
Confirm your local, if: ZH_CN.GB2312ZH_CN. GBK the following:

In the/etc/samba/smb.conf [Global] segment plus:
Display CharSet = cp936
Unix CharSet = cp936
DOS charset = cp936

Once setup is complete, you need to log off once. Before you can see the Chinese directory.
Edit
SMB User Password

The SMB user password can be the same or different from the UNIX account password, and there is no connection between them.
#smbpasswd-A user

To set the SMB user password for user Add.

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.