在Ubuntu中实现文件共享有多种方法,以下是使用VMware虚拟机和Samba工具两种常见方式的详细步骤:
C:\shared
。study01-Ubuntu-share
。sudo apt-get update
sudo apt-get install open-vm-tools
sudo mkdir /mnt/hgfs
sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000 -o umask=022
/mnt/hgfs
目录下看到共享文件夹。/etc/fstab
文件:sudo vim /etc/fstab
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other 0 0
sudo apt-get update
sudo apt-get install samba samba-common
sudo mkdir /home/shared
sudo chmod 777 /home/shared
sudo useradd -M -d /home/shared -s /sbin/nologin shareduser
sudo smbpasswd -a shareduser
/etc/samba/smb.conf
文件:sudo vim /etc/samba/smb.conf
[shared]
path = /home/shared
available = yes
valid users = shareduser
read only = no
browsable = yes
public = yes
writable = yes
sudo systemctl restart smbd
\\Ubuntu_IP\shared
Ubuntu_IP
是Ubuntu主机的IP地址。通过以上步骤,您可以在Ubuntu中实现文件共享。请根据您的具体需求选择合适的方法。