第一步:配置网络:
[root@liu workspace]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 HWADDR=00:0C:29:FD:02:C5 TYPE=Ethernet UUID=9296e980-2d5c-4773-a4ba-a73e258cd09c ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=192.168.164.130 PREFIX=24 GATEWAY=192.168.164.2 |
重启网络服务:
Service network restart
检验网络的连同性:
步骤二:检验samba服务器软件包安装
rpm -qa|grep samba
[root@liu workspace]# rpm -qa |grep samba samba4-libs-4.0.0-58.el6.rc4.x86_64 samba-3.6.9-164.el6.x86_64 samba-client-3.6.9-164.el6.x86_64 samba-common-3.6.9-164.el6.x86_64 samba-winbind-3.6.9-164.el6.x86_64 samba-winbind-clients-3.6.9-164.el6.x86_64 |
若没安装,则安装:
安装 yum install samba
步骤三:配置samba服务器服务文件
位置及名称
[root@liu workspace]# vim /etc/samba/smb.conf
[ls] comment=work path=/workspace writable=yes |
创建共享用户:
Useradd samba
创建密码:
Passwd samba
键入密码,并再键入密码进行确认
给samba服务添加用户:
Smbpasswd -a samba
键入samba服务的用户认证密码
启动samba服务:
Service smb start
验证samba服务是否配置配置成功:
当samba用户对共享的文件夹有写的权限时,就可以创建文件及文件夹
在linux主机上访问windows主机共享的资源:
首先在windows主机上共享一个测试文件夹
查看windows主机的IP地址:
然后在linux主机中访问:
[root@liu workspace]# mount -t cifs -o username=administrator,password=pasdword //192.168.1.102/fimle /mnt/share
[root@liu workspace]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg_liu-lv_root 39228028 3225900 34009424 9% / tmpfs 162244 0 162244 0% /dev/shm /dev/sda1 495844 34539 435705 8% /boot /dev/sr0 3762278 3762278 0 100% /media/redhat6 //192.168.1.102/fimle 161028092 133236388 27791704 83% /mnt/share |
[root@liu workspace]# cd /mnt/share/ [root@liu share]# ls 360freeapbetasetupfreewifi5303070.zip Bdyp_setup.exe.xltd.cfg RStudio-1.0.136.exe BaiduNetdisk_5.5.4.exe mysql-5.0.18-win32.zip VNC-6.0.2-Windows_6.0.2.25562.exe BaiduNetdisk554.zip P2WSetupS.exe Bdyp_setup.exe.xltd R-3.3.2-win.exe |
注:如果搭建好的服务器能够访问,但是不能写数据,那么就在linux更改文件的权限如:
chmo 777 共享文件名