First, make sure that samba is installed in your ubuntu. If you install ubuntu server, you can choose to install the samba suite during installation.
If samba is not installed during ubuntu installation, you can install it later,
sudo apt-get install samba
Then modify the samba configuration file, pay attention to it, develop good habits, and back up the file before modification.
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
sudo vi /etc/samba/smb.conf
Search for this line of text code:
; security = user
Replace the following rows
Code:
security = user
username map = /etc/samba/smbusers
Change [global] and change workgroup = MSHOME to the following code: (Note that the WORKGROUP here is the name of the Working Group in the sharing process:
workgroup = WORKGROUP
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936
The following three lines are used to prevent Chinese directory garbled characters. Now you need to add the rails network access account. If this account does not exist in the system
Code:
sudo useradd rails
Note that the above only adds the rails user, but does not grant the user a local logon password. Therefore, this user can only be remotely accessed and cannot log on from the local machine. The samba logon password is also valid.
Different from the logon password on the local machine. Now, you need to add an account for a network user and set your rails password. This password is not used for Logon at startup, but you want to access the WIN shared file or
WIN Shared File Access Password
sudo smbpasswd -a rails
Create a new smbusers file in the samba directory.
sudo vi /etc/samba/smbusers
Add the following line and save it.
rails = “network username”
Use this command to change the rails network access password in the future.
sudo smbpasswd -a rails
To delete a rails account in the future, run this command to delete it.
sudo smbpasswd -x rails
Then test OK.
sudo testparm
Restart the samba server.
sudo restart smbd
sudo restart nmbd
At last, you only need to enter \ ip in your computer on windows to access the client. You need to enter the samba account and password you just set.
References:
Https://help.ubuntu.com/11.04/serverguide/C/samba-fileserver.html
Http://wiki.ubuntu.org.cn/Samba