How to Set shared folders in Linux

Source: Internet
Author: User
How to set the shared folder in Linux-general Linux technology-Linux technology and application information. For more information, see the following. First, install samba:

Sudo apt-get install samba

Sudo apt-get install smbfs

Next we will share the readable and writable folders of the group. Assume that the folder you want to share is/home/ray/share.

First create this folder

Mkdir/home/ray/share

Chmod 777/home/ray/share

Back up and edit smb. conf to allow network users to access

Sudo cp/etc/samba/smb. conf/etc/samba/smb. conf_backup

Sudo gedit/etc/samba/smb. conf

Search for this line of text

; Security = user

Replace the following rows

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 newsfan. The shared folder name is Share.

[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

Change the value here by the way. Find [global] and change workgroup = MSHOME

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. Depending on your local, the UTF-8 may need to be changed to cp936. Do it yourself.

Now you need to add the newsfan network access account. If this account does not exist in the system

Sudo useradd newsfan

Note that the newsfan user is added, but the logon password of the local machine is not granted to the user. 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:

Sudo smbpasswd-a newsfan

Sudo gedit/etc/samba/smbusers

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

Newsfan = "network username"

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

Sudo smbpasswd-a newsfan

Run the command to delete the account of a network user and change-a to-x.

Sudo testparm

Sudo/etc/init. d/samba restart

Finally, log out and log on again or restart the machine.
Related Article

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.