Set Samba shared readable and writable folders in Ubuntu

Source: Internet
Author: User
Tags readable
First of course is to install Samba, hehe:
Code: sudo apt-get install Samba
sudo apt-get install Smbfs
Let's share a group of read and write folders, assuming that the folder you want to share is:/home/ray/share

Create this folder first
Code: Mkdir/home/ray/share
chmod 777/home/ray/share
Backup and edit smb.conf allow network users to access
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 it 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: Newsfan. and the folder's share name is Share

Code: [Share]
Comment = Shared Folder with username and password
Path =/home/ray/share
Public = yes
writable = yes
Valid users = Newsfan
Create mask = 0700
Directory mask = 0700
force user = Nobody
Force Group = Nogroup
Available = yes
browseable = yes
And then by the way change here, find [global] to Workgroup = mshome change to
Code: Workgroup = Workgroup
Display CharSet = UTF-8
Unix CharSet = UTF-8
DOS charset = cp936 The following three lines are to prevent the occurrence of garbled Chinese directory. Which according to your local,utf-8 may need to be changed into cp936. Let's see what I can do.

Now you want to add Newsfan this network access account. If this account is not currently present in the system, then
Code: sudo useradd newsfan
Note that the above only adds Newsfan 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:
Code: sudo smbpasswd-a newsfan
sudo gedit/etc/samba/smbusers
Add the following line to the newly created file and save the
Code: Newsfan = "Network username"
If you need to change the Newsfan network access password in the future, use this command to change
Code: sudo smbpasswd-a newsfan
Delete the network user's account command to change the above-A to-X
Code: sudo testparm
Sudo/etc/init.d/samba restart
Finally quit the log back on or reboot the machine.

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.