Ubuntu 16.04 Samba server, ubuntu16.04

Source: Internet
Author: User

Ubuntu 16.04 Samba server, ubuntu16.04

The Samba server is built to implement a Linux shared directory, which can be directly accessed in Windows.

This section describes how to build the Samba service in ubuntu 16.04.

1. Install the Samba Service

sudo apt install samba

The following error occurs during installation:

Error: 1 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 samba-libs amd64. 3.11 + dfsg-0ubuntu0.16.04.7
404 Not Found [IP: 91.189.88.161 80]
.....
.....
E: several software packages cannot be downloaded. Do you want to run apt-get update or add the -- fix-missing option?

Execute apt-get update as prompted

sudo apt-get update

And then reinstall it.

2. modify the configuration file

sudo vim  /etc/samba/smb.conf

The Samba configuration of ubuntu is a little simpler than that of the red hat. You can simply add the attribute of the shared directory at the end.

You do not need to set the security value, but are prone to errors.

Add the following content directly at the end of the file:

[Need] # when accessing the Samba server in Windows, the directory name is displayed, and comment = need share is written in the top level. # For the description of the shared directory, write browseable = yes # Whether the shared directory is visible, no is invisible, yes or do not write the default visible path =/share # shared directory path strength create mask = 0777 # create File default permission directory mask = 0777 # create directory default permission valid users = tom # specify login User, if this option is left blank, the user is visible to all by default. force user = nobody # The specified user can log on. Other users do not have the permission to log on. nobody does not limit force group = nogroup, specify User Group public = yes # Whether to view writable = yes for all successfully logged-on users # Write Permission, directory permission must also be permitted available = yes # whether to set the shared directory to be visible

Determine whether to log on to ubuntu with the valid users parameter. If this parameter is not added, you do not need to log on.

If you add this parameter and specify a user, the user needs to log on.

3. Restart the Samba service.

sudo /etc/init.d/samba restart

  Reboot Error  

        [....] Restarting nmbd (via systemctl): nmbd.serviceJob for nmbd.service failed because the control process exited with error code. See "systemctl status nmbd.service" and "journalctl -xe" for details.        failed!

  Error cause:

Samba Server version 4.2 or later does not support security = share. You can remove it or change it to security = user, that is, Samba server 4. in the above versions, You need to log on or access Windows directly,
It is no longer determined by security = share or security = user, but by the attributes of the shared files. Therefore, security is generally ignored.
  

  Solution:

Delete security = share

4. Create a user

Sudo adduser tom is adding user "tom "... adding new group "tom" (1001 )... adding the new user "tom" (1001) to the group "tom "... create a home directory "/home/tom "... copying file from "/etc/skel... enter a new UNIX Password: <-- User Logon password. This password does not have any connection with the password used to log on to Samba. re-enter the new UNIX Password: passwd: if you have successfully updated the password and are changing tom's user information, enter a new value or press enter to use the default name []: tom room number []: work phone number []: home phone number []: Other []: Is the information correct? [Y/n] y

5. Add users to the Samba Server LIST

Sudo smbpasswd-a tom <-- the user must have the New SMB password: <-- password for logging on to the Samba service Retype new SMB password:

If the user does not exist, the following error is prompted:
Failed to add entry for user xxxx
6. Access
1) valid users = tom. This item does not exist.
Windows: 'win' + R enter "local IP Address" to directly access the shared directory.
  

  

  

 


2) valid users = tom added this item
Windows: 'win' + R enter "local IP Address" to access the shared directory.
Only tom users can log on. Other users can log on to Samba.
In the Server LIST, logon fails.

  

  

Logon successful


  

  


3) add multiple users to log on
Valid users = tom, lily, xxx
Create a user and add it to the Samba Server LIST. For details, refer to steps 4 and 5.
At this time, all users in this list can log on successfully.


 

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.