在Ubuntu上设置共享文件夹的方法主要有两种:使用Samba共享和使用NFS共享。
使用Samba共享:
sudo apt update
sudo apt install samba
sudo mkdir /path/to/shared_folder
sudo chmod -R 777 /path/to/shared_folder
[shared_folder]
path = /path/to/shared_folder
writable = yes
guest ok = yes
sudo systemctl restart smbd
sudo systemctl restart nmbd
使用NFS共享:
sudo apt update
sudo apt install nfs-kernel-server
sudo mkdir /path/to/shared_folder
sudo chmod -R 777 /path/to/shared_folder
/path/to/shared_folder *(rw,sync,no_subtree_check)
sudo exportfs -a
sudo systemctl restart nfs-kernel-server
sudo mount ubuntu_ip:/path/to/shared_folder /mnt/shared_folder
以上是在Ubuntu上设置共享文件夹的两种方法,根据实际需求选择适合的方法进行设置。