Samba server configuration on Ubuntu

Source: Internet
Author: User
Install Samba and install sambasudoapt-getinstallsamba. The first step is to create a shared directory. For example, to create/home/username/share, create the folder first (This username is your username, I wrote this for ease of understanding. Remember to change it by yourself. Code: mkdir/home/user name/share (create share folder) chmod777/home/user name/share (set this folder) Install Samba

Install samba

sudo apt-get install samba
Configuration

The first step is to create a shared directory: for example, to create/home/user name/share, first create this folder (this user name is your user name, which I wrote for ease of understanding, remember to change it by yourself)

Code:

Mkdir/home/user name/share (create a share folder)
Chmod 777/home/user name/share (set the folder permission to make it readable and writable for all users to run)

Back up and edit smb. conf to allow network users to access (develop a good habit of backing up at any time, you will find out how wise the original backup is at key times !) 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 the following rows

Code:

security = user
username map = /etc/samba/smbusers

Add the following lines to the end of the file. Assume that the user allowed to access the file is new. The Share Name of the folder is Share # The reason for this is that we will create an smb User new and allow XP users to communicate with us through this new. Of course, you can write it as your favorite name, but you only need to keep it 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 # is used to specify the owner user of the file to be created. In this way, operations performed by other systems on the shared directory are equivalent to operations performed by the specified user.

Force group = nogroup # It is used to specify the owner group of the created file (ensure that the group name exists; otherwise, an error occurs and the connection fails)

Available = yes

Browseable = yes

Change [global] and change workgroup = MSHOME to the following code: (Note that the WORKGROUP here is the name of the Working Group in the sharing process:

Workgroup = WORKGROUP

Displays charset = UTF-8

Unix charset = UTF-8

Dos charset = cp936


The following three lines are used to prevent Chinese directory garbled characters. Now you want to add the new network access account. If this account does not exist in the system

Code:

Sudo useradd new


Note that the new user is added, but the user is not given the logon password of the local machine. Therefore, this user can only be remotely accessed and cannot log on from the local machine. In addition, the samba logon password can be different from the local logon password. Now you want to add a network user account:

Code:

Sudo smbpasswd-a new (set your new password. This password is not used for Logon at startup, is the password you need to enter when accessing the WIN shared file or WIN shared file) sudo gedit/etc/samba/smbusers


Add the following line to the new file and save it.

Code:

New = "network username"

Use this command to change the new network access password in the future.

Code:

Sudo smbpasswd-a new

Run the "delete account" command to change the preceding-a to-x sudo smbpasswd-x new.

Test and restart samba

Code:

Sudo testparm

Sudo/etc/init. d/samba restart

Remote Access to UNIX systems

Sudo mount-t cifs-o uid = user name, user = samba user name, password = samba user password, file_mode = 0777, dir_mode = 0777 // 10.41.0.102/Share/var/www/TcWebFile

Windows Remote Access

\ Server IP Address

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.