在Ubuntu中共享文件夹主要有以下两种方法:
sudo apt update
和sudo apt install samba
。mkdir
命令创建,如sudo mkdir /home/shared
,再用chmod
设置权限,如sudo chmod 777 /home/shared
。/etc/samba/smb.conf
文件,在末尾添加共享定义,如[share]
,并设置path
、browseable
、writable
等参数。sudo smbpasswd -a username
,输入并确认密码。sudo systemctl restart smbd
。sudo apt update
和sudo apt install nfs-kernel-server
。mkdir
命令创建,如sudo mkdir /srv/nfs/share
,并设置权限sudo chmod 777 /srv/nfs/share
。/etc/exports
文件,添加/path/to/shared_folder *(rw,sync,no_subtree_check)
。sudo systemctl start nfs-kernel-server
。