update current software
sudo apt-get upgrade
sudo apt-get update
sudo apt-get dist-upgrade
Install samba service
sudo apt-get install samba samba-common
Configure shared directory
Here, the user directory is used as a shared directory, and the configuration file /etc/samba/smb.conf is modified
# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
[homes]
comment = Home Directories
browseable = yes
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
read only = no
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0755
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0755
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# Un-comment the following parameter to make sure that only "username"
# can connect to \\server\username
# This might need tweaking when using external authentication schemes
valid users = %S
Add samba access account and password
The added user needs to exist in the system account, otherwise the addition fails. For example, the added user name is lhy, and the command is as follows:
sudo smbpasswd -a lhy
Next, enter the password according to the prompt.
Restart the samba service
sudo service smbd restart
Access samba service in windows
Next access samba in windows by mapping a network drive.