Ubuntu22.04配置smb共享

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:~# 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值