ubuntu20.04 open samba service

  1. update current software

sudo apt-get upgrade
sudo apt-get update
sudo apt-get dist-upgrade
  1. Install samba service

sudo apt-get install samba samba-common
  1. 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
  1. 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.

  1. Restart the samba service

sudo service smbd restart
  1. Access samba service in windows

Next access samba in windows by mapping a network drive.

Guess you like

Origin blog.csdn.net/weicao1990/article/details/129723983