samba简介
Samba是在Linux和Unix系统上实现SMB协议的一个免费软件,能够完成Windows,mac操作系统下访问linux系统下的共享文件
samba安装
使用apt命令安装samba
$ sudo apt-get install samba samba-common
配置
创建共享文件路径
在home路径下操作
$ sudo mkdir share
修改其权限
sudo chmod 777 share
修改samba的配置文件
$ sudo vi /etc/samba/smb.conf
在文件最后添加红框里的内容
创建samba账户
$ sudo touch /etc/samba/smbpasswd
$ sudo smbpasswd -a YOUR_NAME #你的用户名
接着创建共享密码并确认密码。
重启samba
当对配置进行了更新,需要重启samba软件才可生效
$ sudo /etc/init.d/smbd restart
mac下访问
填入你的ubuntu下的ip地址,可以通过ifconfig
查看
接着点"连接",第一个次会出现这个界面,名称就是刚才创建共享文件账户时的用户名,密码是共享密码。
点“好”后,可能会出现这种问题
可能是ubuntu文件配置出错了,哇 这个问题搞了半天才好。。。。
我们进入ubuntu,找到那个共享文件share
,右键查看属性,找到本地网络共享,当我们点创建共享时会出现这种错误
“net usershare”返回错误 255:net usershare add: cannot share path /home/rzt/share as we are restricted to only sharing directories we own.
Ask the administrator to add the line "usershare owner only = false"
to the [global] section of the smb.conf to allow this.
尤其是这句话,
Ask the administrator to add the line "usershare owner only = false"
然后我们打开配置文件
$ sudo vi /etc/samba/smb.conf
在usershare allow guests = yes
下添加上这句话usershare owner only = false
保存退出后,重新启动下samba
然后在mac下再连接一次,就成功了