1.安装samb
$ sudo apt-get install samba
2.修改配置文件
修改/etc/samba/smb.conf 文件
[work]
comment = for good work
path = /home/sy
browseable = yes
writable = yes
guest ok = yes
public = yes
force user = sy
force group = sy
3.创建samba用户
$ sudo smbpasswd -a sy
注意,创建smb的sy用户之前,必须先确保有一个同名的Linux用户,否则samba用户会创建失败。
4.重启samba服务
$ sudo service smbd restart
》ubuntu14.04 共享文件无法访问问题
按常规配置后,在windows访问ubuntu的共享文件,弹出
"无法访问。您可能没有权限使用网络资源,请与这台服务器的管理员联系以查明您是否有访问权限。指定的网络名不再可用。"
最后分别查看 vim /var/log/samba/log.%m和log.sabd下的日志文件发现:
[2017/05/06 21:29:27.121208, 0] ../lib/util/become_daemon.c:111(exit_daemon)
126 STATUS=daemon failed to start: Samba detected misconfigured 'server role' and exited. Check logs for details, error code 22
127 [2017/05/06 21:42:06.930436, 0] ../source4/smbd/server.c:372(binary_smbd_main)
128 samba version 4.3.11-Ubuntu started.
129 Copyright Andrew Tridgell and the Samba Team 1992-2015
130 [2017/05/06 21:42:08.189548, 0] ../source4/smbd/server.c:477(binary_smbd_main)
131 At this time the 'samba' binary should only be used for either:
132 'server role = active directory domain controller' or to access the ntvfs file server with 'server services = +smb' or the rpc proxy with 'dcerpc endpoint servers = remote'
133 You should start smbd/nmbd/winbindd instead for domain member and standalone file server tasks
134 [2017/05/06 21:42:08.189591, 0] ../lib/util/become_daemon.c:111(exit_daemon)
135 STATUS=daemon failed to start: Samba detected misconfigured 'server role' and exited. Check logs for details, error code 22
136 [2017/05/07 07:10:25.278602, 0] ../source4/smbd/server.c:372(binary_smbd_main)
137 samba version 4.3.11-Ubuntu started.
138 Copyright Andrew Tridgell and the Samba Team 1992-2015
139 [2017/05/07 07:10:25.863785, 0] ../source4/smbd/server.c:477(binary_smbd_main)
140 At this time the 'samba' binary should only be used for either:
141 'server role = active directory domain controller' or to access the ntvfs file server with 'server services = +smb' or the rpc proxy with 'dcerpc endpoint servers = remote'
142 You should start smbd/nmbd/winbindd instead for domain member and standalone file server tasks
143 [2017/05/07 07:10:25.863853, 0] ../lib/util/become_daemon.c:111(exit_daemon)
144 STATUS=daemon failed to start: Samba detected misconfigured 'server role' and exited. Check logs for details, error code 22
145 [2017/05/07 15:42:29.689977, 0] ../source4/smbd/server.c:372(binary_smbd_main)
log.sabd:
20 STATUS=daemon 'smbd' finished starting up and ready to serve connections
21 [2017/05/06 19:12:58.510905, 0] ../lib/util/become_daemon.c:124(daemon_ready)
22 STATUS=daemon 'smbd' finished starting up and ready to serve connections
23 [2017/05/06 19:51:53.145590, 0] ../lib/util/become_daemon.c:124(daemon_ready)
24 STATUS=daemon 'smbd' finished starting up and ready to serve connections
25 [2017/05/06 20:16:27.777622, 0] ../lib/util/become_daemon.c:124(daemon_ready)
26 STATUS=daemon 'smbd' finished starting up and ready to serve connections
27 [2017/05/06 20:16:30.149027, 0] ../lib/util/become_daemon.c:124(daemon_ready)
28 STATUS=daemon 'smbd' finished starting up and ready to serve connections
29 [2017/05/06 21:25:34.463246, 0] ../lib/util/become_daemon.c:124(daemon_ready)
30 STATUS=daemon 'smbd' finished starting up and ready to serve connections
31 [2017/05/06 21:25:36.010419, 0] ../lib/util/become_daemon.c:124(daemon_ready)
通过 sudo apt-get install libtalloc2 重新安装后解决