是的,CentOS 分區可以共享。CentOS 支持多種文件共享協議,如 Samba 和 NFS,這使得在不同操作系統之間共享文件和目錄變得簡單。以下是使用這兩種協議進行 CentOS 分區共享的方法:
sudo yum install samba
編輯 /etc/samba/smb.conf
文件,添加共享文件夾的配置。例如:
[shared]
path = /path/to/your/folder
available = yes
valid users = user1, user2
read only = no
browsable = yes
public = yes
writable = yes
sudo smbpasswd -a user1
sudo smbpasswd -a user2
sudo systemctl start smb
sudo systemctl enable smb
在其他設備上使用 Samba 客戶端訪問共享文件夾,輸入設置的用戶名和密碼。
sudo yum install nfs-utils rpcbind
編輯 /etc/exports
文件,添加共享文件夾的配置。例如:
/path/to/your/folder *(rw,sync,no_root_squash,no_all_squash)
sudo systemctl start nfs
sudo systemctl enable nfs
sudo systemctl start rpcbind
sudo systemctl enable rpcbind
在其他設備上使用 mount
命令掛載共享文件夾。例如:
mount -t nfs 192.168.1.100:/path/to/your/folder /mnt/local/mount/point
通過以上步驟,您可以在 CentOS 系統上設置共享文件夾,實現與 Windows、Linux 或其他操作系統的文件和目錄共享。請根據您的具體需求選擇合適的共享方法,并確保正確配置防火墻規則以允許相應的端口通信。