Ubuntu 18.04 and windows create a shared folder

1. Install samba

sudo apt install samba
sudo apt install cifs-utils

2. Create a shared directory

mkdir /home/yourname/share (yourname is the folder under home, which should exist when you create a new virtual machine, corresponding to the name of the virtual machine. The path of this folder is actually the path of the '~' symbol) sudo chmod 777
/ home/yourname/share

3. Create a samba configuration file and copy a copy

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
and add the following lines at the end of smb.conf
[share]
path = /home/yourname/share
available = yes
browseable = yes
valid user = test
public = yes
writable = yes

4. Create a samba account

cd /etc/samba
sudo mkdir touch smbpasswd
sudo smbpasswd -a yourname
If encountered: New SMB password: Retype new SMB password: Failed to add entry for user test. This is because no corresponding system account has been added. Just add the corresponding system account sudo groupadd test -g 6000 sudo useradd test -u 6000 -g 6000 -s /sbin/nologin -d /dev/null At this time , sudo smbpasswd -a test






5. Restart the samba server

sudo /etc/init.d/smbd restart

6. Test

Open the folder under windows, enter
\\ip address\share
and then you will be prompted to enter the user name and password. These two are the user name and password of the system account you just set up. Then you can enter the shared folder

7. If the FTP of the shared folder in Windows fails, please refer to the link below

https://blog.csdn.net/maxzero/article/details/81410620

Guess you like

Origin blog.csdn.net/pku_Coder/article/details/82817248