samba服务器的搭建

来源:互联网 发布:太原上知教育 编辑:程序博客网 时间:2024/05/30 04:54
samba服务器的搭建


1.系统版本
#cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
2.软件包的安装
yum install samba -y
3.编辑配置和创建共享文件
# vim /etc/samba/smb.conf
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.


[global]
        workgroup = SAMBA
        security = user


        passdb backend = tdbsam


        printing = cups
        printcap name = cups
        cups options = raw




[ftp]
        comment =  ftp
        path = /mnt/ftp
        writeable = yes
        browseable = yes
        write list = admi

配置文件的语法测试
#testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[ftp]"
Loaded services file OK.
Server role: ROLE_STANDALONE


Press enter to see a dump of your service definitions



mkdir -pv /mnt/ftp
chmod -R 766 /var/ftp
chown -R nobody.nobody /mnt/ftp
4.启动samba服务


# systemctl start smb
# systemctl start nmb


5.添加samba用户


# useradd admin -s /sbin/nologin -M
# smbpasswd -a admin
New SMB password:
Retype new SMB password:
Added user admin.
# smbpasswd -e admin     
Enabled user admin.


重启samba
# systemctl restart smb
# systemctl restart nmb


设置开机启动
# systemctl enable smb
# systemctl enable smb






OK 我们可以用windows访问samba的共享文件了

0 0