安装samba服务器
|
1
2
3
4
|
#forCentOS
yum install samba
#forDebian
apt-get installsamba
|
配置samba服务器
vi /etc/samba/smb.conf
| 1 |
vi/etc/samba/smb.conf
|
在配置文件最后加入下面配置可以把整个linux文件系统共享出来:
[root] comment=this is Linux share directory path=/ public=yes writable=yes guest ok=no create mask=0775 directory mask=0775
|
1
2
3
4
5
6
7
8
|
[root]
comment=this isLinux share directory
path=/
public=yes
writable=yes
guest ok=no
createmask=0775
directory mask=0775
|
启动samba服务器,别忘了关闭SELinux,否则可能导致权限问题
#for CentOS service smb restart service nmb restart #for Debian service smbd restart service nmbd restart
|
1
2
3
4
5
6
|
#forCentOS
service smb restart
servicenmb restart
#for Debian
servicesmbd restart
service nmbd restart
|
设置root帐户密码
smbpasswd -a root
| 1 |
smbpasswd-a root
|
开放防火墙
#for CentOS iptables -I INPUT -p tcp --dport 139 -j ACCEPT iptables -I INPUT -p tcp --dport 445 -j ACCEPT iptables -I INPUT -p udp --dport 137 -j ACCEPT iptables -I INPUT -p udp --dport 138 -j ACCEPT service iptables save
|
1
2
3
4
5
6
|
#forCentOS
iptables -IINPUT -ptcp --dport139 -jACCEPT
iptables-I INPUT-p tcp--dport 445-j ACCEPT
iptables -IINPUT -pudp --dport137 -jACCEPT
iptables-I INPUT-p udp--dport 138-j ACCEPT
service iptables save
|
windos下面使用samba服务器
打开”我的电脑”,”工具”菜单下面的”映射网络驱动器”
选择其它用户
输入 \\xx.xx.xx.xx\root
输入 root
输入 “密码”