Linux虚拟机配置/访问samba服务器

1 配置samba服务器

引自百度经验:配置samba服务器html

完成上述配置以后,共享文件夹将位于绝对路径/sambashell

利用形如以下的命令,将但愿共享的文件或者文件夹复制到该/samba文件夹,便可从Windows侧访问到:服务器

[tongbo@localhost test]$ sudo cp -r a.txt /samba
复制代码

2 在Windows侧访问samba共享文件夹

2.1 查看虚拟机IP地址

  • 终端输入ifconfig -a命令
[root@localhost samba]# ifconfig -a
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.103  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::1007:645a:b0f2:78dd  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a7:d8:a7  txqueuelen 1000  (Ethernet)
        RX packets 2485  bytes 914380 (892.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1291  bytes 121433 (118.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 68  bytes 5912 (5.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 68  bytes 5912 (5.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:ea:5b:a4  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0-nic: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:ea:5b:a4  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost samba]# 
复制代码

在结果中的ens32中,能够看到inet 192.168.2.103,便可获得虚拟机的IP地址。网络

  • 可视化界面

CentOS 7 桌面 --> 应用程序 --> 系统工具 --> 设置 --> 网络工具

2.2 Windows查看samba共享文件夹

  • 打开资源管理器,以下图输入\\192.168.?.?
访问samba共享文件夹
  • 登陆samba用户,注意这里登陆的是配置samba服务器时的用户
登陆samba帐户
  • 操做文件夹数据
操做samba共享文件夹数据