Article Title: Shared Folder user settings in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
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.