27为服务端,28为客户端。
27服务器
配置步骤:
# sudo apt-get install samba
# sudo vi /etc/samba/smb.conf
[share]
comment = share folder
browseable = yes
path = /mnt
public = yes
available = yes
writable = yes
# service smbd restart
# systemctl enable smbd
# apt-get install cifs-utils
配置记录:
root@dell-r740-27:/mnt# sudo apt-get install samba
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
samba is already the newest version (2:4.15.13+dfsg-0ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.
root@dell-r740-27:/mnt# sudo vi /etc/samba/smb.conf
[share]
comment = share folder
browseable = yes
path = /mnt
public = yes
available = yes
writable = yes
root@dell-r740-27:/mnt# service smbd restart
root@dell-r740-27:~# systemctl enable smbd
Synchronizing state of smbd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable smbd
root@dell-r740-27:~#
28服务器
配置步骤:
# cd /mnt
# mkdir smb
# chmod 777 /mnt/smb
# apt-get install cifs-utils
# mount.cifs -o username=abc,password=abc@123 //172.16.12.27/share /mnt/smb
# df -h
# vi /etc/fstab
# cat /etc/fstab
配置记录:
root@dell-r740-28:~# apt-get install cifs-utils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
cifs-utils is already the newest version (2:6.14-1ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.
root@dell-R740-28:~# mount.cifs -o username=abc,password=abc@123 //172.16.12.27/share /mnt/smb
root@dell-R740-28:~# df -h
文件系统 容量 已用 可用 已用% 挂载点
tmpfs 26G 4.8M 26G 1% /run
/dev/sda3 439G 323G 93G 78% /
tmpfs 126G 8.0K 126G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda2 512M 5.3M 507M 2% /boot/efi
//172.16.12.27/share 98G 20G 78G 21% /mnt/smb
root@dell-r740-28:~# vi /etc/fstab
root@dell-r740-28:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=3353c5a5-d2e3-4f62-a2ee-4ef944872136 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda2 during installation
UUID=3FC1-CAF8 /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
//172.16.12.27/share /mnt/smb cifs rw,username=abc,password=abc@123 0 0
root@dell-R740-28:~#