创建新虚拟机配置yum源

  1. vi /etc/yum.repos.d/local.repo
  2. [centos]
  3. name=centos
  4. baseurl=file:///opt/centos
  5. gpgcheck=0
  6. enabled=1

下载Samba

  1. yum install -y samba

创建用户

  1. smbpasswd -a root

修改配置文件

  1. [global]
  2. workgroup = SAMBA
  3. security = user
  4. passdb backend = tdbsam
  5. printing = cups
  6. printcap name = /dev/null
  7. printcap name = lpstat
  8. load printers = no
  9. cups options = raw
  10. disable spoolss = yes
  11. 加入
  12. [share]
  13. path=/opt/share
  14. browseable= yes
  15. piblic = yes
  16. writable = yes

创建用户

  1. mkdir /opt/share //创建共享目录
  2. chmod 777 /opt/share 赋与 共享目录所有权限
  3. systemctl start smb
  4. systemctl start nmb //启动samba守护进程
  5. netstat -ntpl //查找139、445端口

实现Linux之间共享

需要俩台虚拟机,在客户端用服务端的ftp配置yum源

  1. 服务端
  2. yum install -y vsftpd
  3. vi /etc/vsftpd/vsftpd.conf
  4. anon_root=/opt
  5. systemctl restart vsftpd
  6. systemctl enable vsftpd
  7. netstat -ntpl /查看是否有20 21 端口
  8. 客户端
  9. [centos]
  10. name=centos
  11. baseurl=ftp://192.168.100.66/centos
  12. gpgcheck=0
  13. enabled=1
  1. yum install samba-client cifs-utils -y
  2. smbclient -L 192.168.100.66 -U root /输入密码
  3. 挂载
  4. mount -t cifs //192.168.200.12/share /mnt/
  5. df -h /查看是否挂载成功