共享文件可以写入吗?

共享文件可以写入吗?

我尝试过多种代码来允许共享 Windows 文件夹中的文件可写。新创建的 VM 中的初始代码基于本教程。 这邮政有一个可接受的答案,我根据该答案编写了下面的代码。我尝试复制该帖子的积极结果,但失败了。

我的目标是在我家(即在野外无法访问)的网络中共享一个网站的源代码,只是为了看看是否可以做到。源代码是用于 Symfony 应用程序的,它需要网站的常规权限以及包含var其日志和缓存的子文件夹的 777 权限。我添加了一个名为的空文件xyz以测试其可写性。

环境:Windows 10 Pro,版本 22H2;VirtualBox v7 VM 和 Ubuntu Server 22.04.3。共享是\\geolaptop\diet。VM 已更新和升级。VM 用户是sam为了方便使用。以下是我使用过的命令序列(最佳重建)。

需要进行哪些更改才能使共享可写?

代码序列:

sudo apt update && sudo apt upgrade -y
sudo apt install virtualbox-guest-utils
sudo apt install samba
mkdir /home/sam/diet
sudo nano /etc/samba/smb.conf

   [diet]
       comment = Can sam work here?
       path = /home/sam/diet
       read only = no
       browsable = yes
       
sudo service smbd restart
sudo ufw allow samba
sudo smbpasswd -a sam
sudo smbpasswd -e sam
sudo nano /etc/samba/smb.conf

   [diet]
       comment = Can sam work here?
       path = /home/sam/diet
       read only = no
       browsable = yes
       force user = sam
       
sudo service smbd restart
cd ./diet
nano xyz  => not writable
       
sudo chmod -R 777 .
nano xyz  => not writable

sudo nano /etc/samba/smb.conf
#map to guest = bad user
sudo service smbd restart
nano xyz  => not writable

sudo nano /etc/samba/smb.conf

[diet]
   comment = Can sam work here?
   path = /home/sam/diet
   read only = no
   available = yes
   browseable = yes
   writable = yes
   guest ok = no
   public = yes
   printable = no
   locking = no
   strict locking = no
   
sudo service smbd restart
nano xyz  => not writable

sudo nano /etc/samba/smb.conf

[diet]
   comment = Can sam work here?
   path = /home/sam/diet
   read only = no
   available = yes
   browseable = yes
   writable = yes
   guest ok = no
   public = yes
   printable = no
   locking = no
   strict locking = no
   force create mode = 0660
   force directory mode = 2770
   force user = sam
   force group = sam

sudo service smbd restart
nano xyz  => not writable

相关内容