在Ubuntu From Scratch系统中,可通过以下方式共享资源:
sudo apt update && sudo apt install samba
sudo mkdir /path/to/shared_folder
sudo chmod -R 777 /path/to/shared_folder # 开放权限(按需调整)
/etc/samba/smb.conf,末尾添加:[shared]
path = /path/to/shared_folder
browsable = yes
writable = yes
guest ok = yes # 允许匿名访问(可选)
sudo systemctl restart smbd nmbd
\\Ubuntu_IP\sharedsmbclient 或挂载命令。sudo apt update && sudo apt install nfs-kernel-server
/etc/exports,添加:/path/to/shared_folder *(rw,sync,no_subtree_check)
sudo exportfs -as && sudo systemctl restart nfs-kernel-server
# 客户端挂载:sudo mount Ubuntu_IP:/path/to/shared_folder /mnt
/etc/netplan/01-netcfg.yaml,示例:network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
应用配置:sudo netplan apply。rw可编辑,ro只读)。参考来源: