Samba 部署
登录 192.168.200.60 虚拟机,首先修改主机名
[root@lnmp ~]# hostnamectl set-hostname samba
[root@lnmp ~]# bash
[root@samba ~]# hostnamectl
Static hostname: samba
Icon name: computer-vm
Chassis: vm
Machine ID: c4e93637af02487fb22ddc003a2e7bd7
Boot ID: 6c24fdde08ab4e629c7546d7b3c1e2a6
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.el7.x86_64
Architecture: x86-64
安装 Samba 服务
[root@samba ~]# yum install -y samba
Loaded plugins: fastestmirror
centos | 3.6 kB 00:00
epel | 4.7 kB 00:00
Loading mirror speeds from cached hostfile
Resolving Dependencies
–> Running transaction check
—> Package samba.x86_64 0:4.6.2-8.el7 will be installed
Complete!
配置 Samba 的配置文件 /etc/samba/smb.conf
[root@samba ~]# vi /etc/samba/smb.conf
1、修改[global]中的内容,找到配置文件中的字段并修改,添加disable spoolss = yes
load printers = no cups options = raw ;
printcap name = /dev/null
#obtain a list of printers automatically on UNIX System V systems:
; printcap name = lpstat
; printing = bsd
disable spoolss = yes

2、在配置文件的最后 shift+gg
[share]
path = /opt/share 共享路径
browseable = yes 操作权限
public = yes 访问权限
writable = yes
对文件的操作权限
创建目录并赋予权限
[root@samba ~]# mkdir /opt/share
[root@samba ~]# chmod 777 /opt/share/
启动 Samba 服务
[root@samba ~]# systemctl start smb
[root@samba ~]# systemctl start nmb
查看端口启动情况,(netstat 命令若不能用,自行安装 net-tools 软件包)
samba的端口为445
[root@samba ~]# yum install -y net-tools
[root@samba ~]# netstat -ntpl
创建 Samba 用户(这个用户必须是系统存在的用户)
[root@samba ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
重启 Samba 服务
[root@samba ~]# service smb restart
Redirecting to /bin/systemctl restart smb.service
按“win+R”键,并输入 Samba 服务的 IP 地址,(在使用 PC 访问 Samba 服务前,确保 Samba 服务器的 SELinux 服务与防火墙服务均处于关闭状态)
[root@samba ~]# systemctl stop firewalld
[root@samba ~]# setenforce 0
在弹出界面输入用户名和密码,然后单击右下角的“确定”按钮(用户名为 root,密码 为 000000)

将之前移动到/media 中的 repo 文件,移动到 share 目录
[root@samba ~]# mv /media/ /opt/share/*
增加其他用户访问
[root@samba ~]# useradd -s /sbin/nologin user001
[root@samba ~]# smbpasswd -a user001
New SMB password:
Retype new SMB password:
Added user user001.
[root@samba ~]# service smb restart 重启服务
进入 cmd 命令行输入如下命令清空 samba 登录记录
重新访问

来源:oschina
链接:https://my.oschina.net/u/4318023/blog/4732098