The Samba server is built to implement the Linux shared directory, and Windows can access the shared directory directly.
Now how to build a Samba service in Ubuntu 16.04 system.
1. Installing Samba Services
sudo Install Samba
The following error occurred during the installation process:
Error: 1 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 samba-libs amd64 2:4.3.11+dfsg-0ubuntu0.16.04.7
404 Not Found [ip:91.189.88.161 80]
.....
.....
E: Several packages cannot be downloaded, do not run Apt-get update or add--fix-missing option to try again?
Follow the prompts to perform apt-get update
sudo apt-get update
Then reinstall the.
2. Modify the configuration file
sudo vim /etc/samba/smb.conf
Ubuntu's samba configuration is a little simpler than red hat, just add the properties of the shared directory at the end.
Instead of setting the security value, setting it up is error-prone.
Add the following directly at the end of the file
[need] # Windows access to the Samba server is the display directory name, shelf write comment = Need share # Description of the shared directory, casually write browseable = Yes # shared directory is visible, no is not visible, yes or not write default visible p Ath =/share # shared directory road Hard Create mask = 07 = 0777 Span style= "COLOR: #000000" > # Create default permissions for a directory valid users = Tom # Specifies the user who is logged on, which does not write, the default Force user = Nobody # specified user can log on, other users do not have permission to log on, nobody does not restrict force group = Nogroup # Ibid, specify user group public = Yes # whether all The successful user is visible writable = Yes # Write permissions, directory permissions also to license available = yes # same is to set whether the shared directory is visible
Whether Ubuntu needs to be logged in with Valid users This parameter determines that if the parameter is not added, you do not need to log in.
Add this parameter and specify the user, then the user needs to log on.
3. Restart Samba Services
sudo /etc/init.d/samba restart
Reboot error occurred
for " systemctl Status Nmbd.service " " Journalctl-xe " for details. Failed!
Cause of Error:
Samba Server version 4.2 or above does not support security = share, can be removed or changed to Security = user, that is, Samba server 4. The above version, for Windows access is required to log on or direct access,
Will no longer have a security=share or security= user decision, but is determined by the properties of the subsequent shared file. Therefore, security is generally ignored.
Workaround:
Remove security = Share
4. Create user
SudoAddUser Tom is adding users"Tom"... Adding new group"Tom"(1001)... Adding new users"Tom"(1001) to the group"Tom"... Create a home directory"/home/tom"... are starting from"/etc/skel"Copy files ... Enter a new UNIX password:<--User Login password, this does not have any contact with the login Samba password re-enter the new UNIX password:passwd: Successfully updated password is changing Tom's user information please enter a new value, or hit Enter to use the default full name []: Tom room number []: Work phone []: Home Phone []: Other []: Is this information correct? [Y/n] Y
5. Add users to the list of samba servers
sudo smbpasswd-a Tom <-- The user must be present with the new SMB password:<-- Login Samba service password Retype new SMB password:
The following error is prompted if the user does not exist:
Failed to add entry for user xxxx
6. Visit
1) Valid users = Tom the item is not
Windows side: ' Win ' + R input "native IP", direct access to the shared directory
2) Valid users = Tom added the item
Windows side: ' Win ' + R input ' native IP ' access to shared directory requires login
And only Tom user can log in, other users are in Samba
The list of servers is also a sign-in failure.
Successful Login
3) Increase multi-user login
Valid users = Tom,lily,xxx
To create a user and add to the list of samba servers, refer to steps 4 and 5
Then the user in this list will be able to log in successfully.
Ubuntu 16.04 Samba Server Setup