Debian实现文件共享主要有以下几种方式:
sudo apt update && sudo apt install samba。/etc/samba/smb.conf,添加共享目录配置(如路径、权限、允许用户等)。sudo smbpasswd -a username添加Samba用户并设置密码。sudo systemctl restart smbd,并开放防火墙端口(TCP 139、445)。\\服务器IP\共享名访问,Linux/macOS用mount -t cifs命令挂载。sudo apt install nfs-kernel-server。/etc/exports,指定共享目录及客户端权限(如rw,sync,no_subtree_check)。sudo exportfs -a并sudo systemctl restart nfs-server。nfs-common后,用mount -t nfs 服务器IP:/共享路径 /本地挂载点挂载。sudo apt install sshfs。sshfs user@服务器IP:/远程目录 /本地挂载点,需输入密码。fusermount -u /本地挂载点。chmod 755或777),避免权限冲突。根据需求选择合适方案,Samba适合跨平台,NFS适合Linux集群,SSHFS适合临时或加密访问。