搭建yum,确保有yum源
Windows与Linux
#下载samba
[root@localhost mnt]# yum install -y samba
#修改与添加配置文件
[root@localhost mnt]# vi /etc/samba/smb.conf
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
printing = cups
printcap name = lpstat
printcap name = /dev/null
load printers = no
cups options = raw
disable spoolss =yes
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
[printers]
comment = All Printers
path = /var/tmp
printable = Yes
create mask = 0600
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @printadmin root
force group = @printadmin
create mask = 0664
directory mask = 0775
[share]
path = /opt/share
public = yes
writable = yes
#创建共享目录
[root@localhost ~]# mkdir /opt/share
[root@localhost ~]# chmod 777 /opt/share/
[root@localhost ~]# ll /opt/
total 0
drwxrwxrwx 2 root root 6 Oct 17 21:17 share
[root@localhost ~]# systemctl restart smb
[root@localhost ~]# systemctl restart nmb
[root@localhost ~]# yum -y install net-tools
[root@localhost ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1461/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1461/smbd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 897/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1152/master
tcp6 0 0 :::445 :::* LISTEN 1461/smbd
tcp6 0 0 :::139 :::* LISTEN 1461/smbd
tcp6 0 0 :::22 :::* LISTEN 897/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1152/master
#配置用户
[root@localhost ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
关闭防火墙和selinux
去Windows的运行窗口输入\\192.168.200.11
修改上传文件在/opt/share
Linux与Linux
#挂载yum,用ftp,第一台安装ftp
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# vi local.repo
[ftp]
name=ftp
baseurl=ftp//192.168.200.11/centos
enabled=1
gpgcheck=0
[root@localhost mnt]# yum insatll -y samba-client cifs-utils
[root@localhost yum.repos.d]# smbclient -L 192.168.200.11 -U root
Enter SAMBA\root's password:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
share Disk
IPC$ IPC IPC Service (Samba 4.7.1)
root Disk Home Directories
Reconnecting with SMB1 for workgroup listing.
Server Comment
--------- -------
Workgroup Master
--------- -------
SAMBA LOCALHOST
[root@localhost yum.repos.d]# mount -t cifs //192.168.200.11/share /mnt/
Password for root@//192.168.200.11/share: ******