安装samba:
sudo apt-get install samba samba-common
由于是挂载另一个磁盘,并作为共享文件存放地:
列出磁盘名和ID
air@air-device:~$ sudo blkid
[sudo] password for air:
/dev/sda1: UUID="a5f1012b-2bc8-4bab-9bd0-970d71d25d53" TYPE="ext4"
/dev/sda3: UUID="a986493f-d482-4c2a-b595-8464b0b56e9d" TYPE="swap"
/dev/sda4: UUID="9536921e-ae42-4378-984f-96363d45be35" TYPE="ext4"
/dev/sda5: UUID="ac42779b-ec32-4f1d-a421-2181ca88366d" TYPE="ext4"
使用gedit修改/etc/fstab文件,在文件末尾加上如下内容并保存:
UUID=a5f1012b-2bc8-4bab-9bd0-970d71d25d53 /data ext4 defaults
使用如下命令创建和共享文件夹:
sudo mkdir /data/share
sudo chmod /data/share
配置samba:
sudo gedit /etc/samba/smb.conf
[family]
comment = My Share Folder
path = /data/share
guest ok = no
valid users = smbuser,@root
browseable = yes
writeable=yes
create mask = 0777 #新文件的默认权限为777
directory mask = 0777 #新目录的默认权限为777
# Cap the size of the individual log files (in KiB).
max log size =
security = user #在global段加入
sudo useradd smbuser
sudo smbpasswd -a smbuser #密码自己设置
sudo chown smbuser:root /data/share #将指定文件的拥有者改为指定的用户或组