Ubuntu14.04环境下Samba报错排错过程
1:确认防火墙关闭
sudo ufw status 查看防火墙的状态
sudo apt-get install ufw 安装ufw
sudo ufw disable 关闭防火墙
2:关闭selinux
sudo apt-get install selinux
sudo vim /etc/samba/smb.conf SELINUX=disabled
getenforce 查看
3:确认上两条无误后,分析日志
看日志 cd /var/log/samba,标红线的是启动日志,其余的是客户端的访问日志:
若不确定哪一个日志是登录报错日志,可以
cd /var/log/samba
rm -rf log.\*
然后用客户端去连接访问一次,就会出现新的日志文件,这里我用10.0.0.126这个IP去访问的,cat log.10.0.0.126 \|grep error ,没有任何错误信息,没去考虑log.yunovo-pc这个log文件,其实error信息在这个里面报错;
[2017/04/19 13:06:54.208565, 0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)
talloc: access after free error - first free may be at ../source3/smbd/open.c:3978
[2017/04/19 13:06:54.208587, 0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)
Bad talloc magic value - access after free
这里可以看到报错,talloc有问题,重装
sudo apt-get install libtalloc2
重装 libtalloc2这个的时候,又有问题:
1:没换源
cd /etc/apt
sudo wget http://mirrors.163.com/.help/sources.list.trusty 下载
cp sources.list sources.list.bak 备份原来的
sudo cp sources.list.trusty sources.list 替换
sudo apt-get update
2:换源后重装libtalloc2还是有问题,卸载libtalloc2,然后在重装
samba 配置, dev中的用户可以read,个人可以写:
添加group
sudo addgroup dev
sudo adduser chenlei dev
sudo vim /etc/samba/smb.conf
[guoxiaoqiang]
path=/home/guoxiaoqiang
write list=guoxiaoqiang
valid users=@dev
public=yes
#writable=yes
create mask = 0777
directory mask = 0777
available = yes
browseable = yes
OLD:
1.sudo apt-get install samba
2.sudo vim /etc/samba/smb.conf
security = user
[gitmanager]
path=/home/gitmanager
valid users=gitmanager
public=yes
write list=gitmanager
create mask = 0777
directory mask = 0777
available = yes
browseable = yes
3.sudo adduser zhangailin
4.sudo smbpasswd -a zhangailin
5.sudo service smbd restart