Mac 10.10 yosemite 安装samba替代系统samba组件

Posted teamlet

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac 10.10 yosemite 安装samba替代系统samba组件相关的知识,希望对你有一定的参考价值。

(根据本文其他参考[2]所描述,本文plist文件中的参数-D应该改为-F)


一、工具 brew


1、brew 介绍

brew 又叫Homebrew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件, 只需要一个命令, 非常方便

brew类似ubuntu系统下的apt-get的功能。

brew 的官方网站: http://brew.sh/  

2、安装brew

打开终端,执行下面语句:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

二、安装samba

1、安装samba

brew install samba

2、禁用 netbiosd sudo launchctl stop com.apple.netbiosd sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist


3、创建目录

cd /Users

sudo mkdir samba

sudo mkdir movie

sudo chmod 777 movie


4、创建两个文件

sudo vi org.samba.nmbd.plist

sudo vi org.samba.smbd.plist

org.samba.nmbd.plist文件内容为

 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.samba.nmbd</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/Cellar/samba/3.6.25/sbin/nmbd</string>
        <string>-D</string>
    </array>
    <key>OnDemand</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>ServiceDescription</key>
    <string>netbios</string>
</dict>
</plist>
 

org.samba.smbd.plist的内容为:

 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.samba.smbd</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/Cellar/samba/3.6.25/sbin/smbd</string>
        <string>-D</string>
    </array>
    <key>OnDemand</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>ServiceDescription</key>
    <string>samba</string>
</dict>
</plist>
 


5、准备smb.conf配置文件

 
[global]
	netbios name = iMac 
	display charset = UTF-8
	server string = Samba
	unix charset = UTF-8
	workgroup = WORKGROUP
	browseable = yes
	security = user
	passdb backend = tdbsam
	guest account = nobody
	guest ok = yes
	invalid users = root
	load printers = no
	printable = no
	map to guest = Bad User
	max protocol = SMB2
	min receivefile size = 16384
	os level = 20
	socket options = TCP_NODELAY IPTOS_LOWDELAY
	syslog = 2
	log file = /var/log/samba.log.%m
        use sendfile = yes
	writeable = yes
	
[movie]
	path = /Users/samba/movie
	read only = no
	guest ok = yes
	create mask = 777
	directory mask = 777
 



6、运行

cd /Users

sudo ln -sfv ./samba/*.plist /Library/LaunchAgents
sudo chmod a+rx ./samba/*.plist
sudo launchctl load -w /Library/LaunchAgents/org.samba.nmbd.plist
sudo launchctl load -w /Library/LaunchAgents/org.samba.smbd.plist


原文地址:http://gcell.blog.163.com/blog/static/52666594201501084530277/


其他参考:

[1]http://hints.macworld.com/article.php?story=20120401160655922

[2]https://gist.github.com/kud/6587477

[3]http://blog.helloyama.com/post/77813860132/replacing-the-os-x-109-mavericks-smb-stack-with

[4]http://blog.rubbingalcoholic.com/post/39412902216/fix-smb-windows-sharing-permissions-issue-in-os-x


配置文件参考

[1]samba官方 smb.conf格式说明

https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/install.html#id2551954

[2]apple samba 配置格式举例

http://www.opensource.apple.com/source/samba/samba-235/samba/examples/smb.conf.default

[3]apple 官方开源配置参考,可以证明 -F 参数是对的

http://www.opensource.apple.com/source/samba/samba-235/org.samba.nmbd.plist


以上是关于Mac 10.10 yosemite 安装samba替代系统samba组件的主要内容,如果未能解决你的问题,请参考以下文章

Mac 10.10 yosemite 安装samba替代系统samba组件

使用 PyCharm CE 在 Mac 10.10 Yosemite 上的 Kivy

Mac OS 10.10 Yosemite正式版怎么升级 升级教程

Mac OS X Yosemite 10.10 配置 Apache+PHP 教程注意事项

Mac Yosemite 10.10 终端命令未找到

在 Mac OS X Yosemite 10.10 上使用 Mamp Pro 进行 Mcrypt