在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
。