注意:安装samba必须先有root权限
安装步骤:
yum install samba
配置
1.执行 whereis samba (查找smb.conf的目录) 2. 执行 vi smb.conf (将下面内容粘贴到smb.conf) [uooc] comment = uooc path = /data/uooc writable = yes
保存并退出;
创建Samba用户
1.建一个系统用户 [root@linux samba]# useradd samba (建一个名叫samba的用户) [root@linux samba]# passwd samba (给samba用户添加密码) Changing password for user samba. New password: (密码要八位以上,不显示在屏幕上) BAD PASSWORD: it does not contain enough DIFFERENT characters Retype new password: (确认密码) passwd: all authentication tokens updated successfully. 2. 创建samba账户 [root@linux samba]# smbpasswd -a samba (-a必须加,为了生成密码文件smbpasswd,该密码是windows登陆Linux的samba用户密码) New SMB password: Retype new SMB password: unable to open passdb database. Added user samba.
关闭防火墙
[root@linux samba]# systemctl stop firewalld.service
[root@linux samba]# service iptables stop [root@linux samba]# setenforce 0
启动Samba
[root@linux samba]# systemctl restart smb.service
使用Samba
到windows下查看samba共享目录是否能够进入:
\\192.168.1.211\uooc
[root@linux samba]
# setenforce 0