########搭建实验环境#########
搭建两台虚拟机 westosa westosb
westosa:
hostname设置为:westos_storage
配置网络仓库
vim westos.repo
[AppStream]
name=AppStream
baseurl=http://172.25.254.72/rhel8/AppStream
gpgcheck=0
[BaseOS]
name=BaseOS
baseurl=http://172.25.254.72/rhel8/BaseOS
gpgcheck=0
westosb同westosa(不改主机名)
###### 1. samba服务简介 ########
作用:
存储分离:将系统和储存分离开(网络共享出去,或磁盘共享出去)
目的:使得其他人也可以访问到存储的信息,方便共享信息
smb = Server Message Block Sum ##windows系统共享文件时用到的协议 smb
cifs = Common Internet File System Miscrosoft ##Linux系统共享文件时用到的协议 cifs
windows系统共享文件时用到的协议smb
smb是由miscrosoft+sun
Linux cifs
######2.samba基本信息######
服务启动脚本:smb.service
主配置目录:/etc/samba
主配置文件:/etc/smb.conf
安全上下文:samba_share_t
端口:139 445
安装包:samba samba-common
######2.samba的安装与启用######
samba的安装:
dnf install samba samba-common samba-client -y ##common服务配置文件 client客户端
samba服务启动:
systemctl enable --now smb
samba服务启用:
firewall-cmd --permanent --add-service=samba
firewall-cmd --reload
测试:
smbclient -L //172.25.254.100 ##当要输入root密码时直接回车(因为没有密码)
###### 3.samba用户的建立 #############
1.samba用户必须是被地存在的用户
2.samba用户的建立
smbpasswd -a lee ##添加用户 lee必须是本地真实存在的用户
pdbedit -L ##查看用户列表
pdbedit -x lee ##删除用户
useradd -s /sbin/nologin lee -M ##建立真实用户lee
smbpasswd -a lee ##建立samba用户并设定密码
smbclient -L //172.25.254.100 -U lee ##samba启用用户lee并列出
Enter SAMBA\lee's password:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
IPC$ IPC IPC Service (Samba 4.11.2)
lee Disk Home Directories
vim /etc/hosts ##如若显示过慢进行地址解析,并重新加载
172.25.254.100 westos_storage.westos.org
#######4.samba用户访问家目录######
当selinux开启时:
setsebool -P samba_enable_home_dirs on ##selinux访问限制打开,则samba用户可以访问自己家目录(因为selinux,samba用户不能直接访问自己家目录)
windows下
\\172.25.254.20 ##访问
net use ##查看访问记录
net use * /del ##删除访问记录
在linux下:
smbclient //172.25.254.20/westos -U westos ##进行访问
#######5.samba服务共享目录 #######
mkdir/westos _share ##只对root用户可写
touch /westos_share/westosfile{1..5}
semanage fcontext -a -t samba_share_t '/westos _share(/.*)?' ##如果
restorecon -RvvF /westos_share
vim /etc/samba/smb.conf
[westos_share] ##共享名称
comment = westos share ##共享说明
path = /westos_share ##共享路径
systemctl restart smb ##重新加载
测试:
smbclient //172.25.254.20/westos_share -U lee ##共享就显示了
cd /etc/samba/ ##samba服务的配置目录
ls
lmhosts smb.conf smb.conf.example ## smb.conf smb的主配置文件 smb.conf.example smb服务的配置文件模板
cp smb.conf.example smb.conf -p ##重新生成配置文件
setsebool -P samba_enable_home_dirs on ##使得selinux中,samba用户可以使用自己的家目录
mkdir /westos_share
ls -ld /westos_share/ ##只有root用户可以对其读写
drwxr-xr-x. 2 root root 6 Aug 10 12:01 /westos_share/
vim /etc/samba/smb.conf
systemctl restart smb
314 [westos_share]
315 comment= westos share
316 path=/westos_share
smbclient -L //172.25.254.100 -U lee
touch /westos_share/westosfile{1..3} ##最后可以访问到这些文件代表成功
smbclient //172.25.254.100/westos_share -U lee ##访问共享时和还会出现selinux的报错
semanage fcontext -a -t samba_share_t '/westos_share(/.*)?' ## 用户建立的目录如果需要通过smb共享,那安全上下文必须设定为 samba_share_t
restorecon -RvvF /westos_share/
smbclient //172.25.254.100/westos_share -U lee ##查看,如若显示则共享成功
Enter MYGROUP\lee's password:
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Tue Aug 10 12:05:26 2021
.. D 0 Tue Aug 10 12:01:23 2021
westosfile1 N 0 Tue Aug 10 12:15:06 2021
westosfile2 N 0 Tue Aug 10 12:15:06 2021
westosfile3 N 0 Tue Aug 10 12:15:06 2021
17814528 blocks of size 1024. 14410328 blocks available
共享系统级目录不成功时则
共享系统级目录时,因为selinux问题导致访问不了则打开
getsebool -a | grep samba
samba_export_all_ro --> off ##打开,selinux不再对samba服务访问文件时的上下文进行限制
samba_export_all_rw --> off ##打开,selinux不再对samba服务访问文件时的上下文进行限制
##### 6.samba的访问控制######
全局设定:
hosts allow 172.25.254.30 172.25.254. ##白名单设定 当写到单独共享时之对此共享生效
hosts deny ##黑名单设定 当写到【GLOBAL】时对samba整体生效
ip:100
vim /etc/samba/smb.conf
91 hosts allow = 172.25.254.200 ##只允许200这台主机来访问当前的samba服务器
systemctl restart smb
ip:72
smbclient -L //172.25.254.100 -U lee
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE ##被拒绝
hosts deny = 172.25.254.200 ##拒绝200这台主机来访问当前的samba服务器
ip:200
smbclient -L //172.25.254.100 -U lee
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE ##被拒绝
ip:100
vim /etc/samba/smb.conf
317 hosts allow = 172.25.254.200 ##westos_share这个共享,只能被200主机访问,只针对westos_share
systemctl restart smb
ip:72
smbclient //172.25.254.100/westos_share -U lee ##访问westos_share被拒
Enter SAMBA\lee's password:
tree connect failed: NT_STATUS_ACCESS_DENIED
#### 7.samba的常用配置参数#####
writable = yes ##可写
write list = westos ##指定用户可写
write list = +westos ##指定组可写
write list = @westos
valid users = lee ##指定访问用户
valid users = +lee|@lee ##指定访问组
browseable = yes|no ##是否隐藏共享map to guest = bad user ##写到全局设定中
guest ok = yes ##允许匿名用户访问
admin users = lee ##指定此共享的超级用户身份呢
browseable = yes|no ##是否隐藏共享
ip:100
vim /etc/samba/smb.conf
317 browseable = no ## browseable=no 隐藏共享目录
systemctl restart smb
ip:200
smbclient -L //172.25.254.100 -U lee ##共享目录被隐藏
Unable to initialize messaging context
Enter SAMBA\lee's password:
Sharename Type Comment
--------- ---- -------
IPC$ IPC IPC Service (Samba Server Version 4.11.2)
lee Disk Home Directories
valid users = lee ##指定访问用户
valid users = +lee|@lee ##指定访问组
writable = yes ##可写
write list = westos ##指定用户可写
write list = +westos ##指定组可写
map to guest = bad user ##写到全局设定中
guest ok = yes ##允许匿名用户访问
318 valid user = westos ##此共享只能通过samba用户 westos 登陆
318 valid user = @westos ##表示 westos 中的组成员可以共享
usermod -G westos lee ##添加 lee 到 westos 组中 则 lee 可以使用(添加的组成员,必须是samba成员)
ip 100
chmod 777 /westos_share/ ##指定权限为满权限
ls -ld /westos_share/
drwxrwxrwx. 2 root root 63 Aug 10 12:05 /westos_share/
vim /etc/samba/smb.conf
319 writable = yes ##westos_share 以读写方式共享
ip:200
mount //172.25.254.100/westos_share /mnt/ -o username=lee,password=westos ##挂载samba共享资源到/mnt中,挂载后,在200测试机的目录中建立文件真实存储文件的位置为samba共享出来的westos_share目录中
touch /mnt/file ##即可在westos_share里建立文件
#########################
320 write list = lee ##只针对于lee用户可写
ip:200
mount //172.25.254.100/westos_share /mnt/ -o username=westos,password=westos
touch /mnt/file1
touch: cannot touch '/mnt/file1': Permission denied ##则使用 westos 用户建立被拒绝
320 write list = +lee ##表示对于lee组成员可写
############################
默认情况下,匿名用户不可以使用samba共享资源
设置匿名用户可以使用samba共享资源
vim /etc/samba/smb.conf
118 map to guest = bad user ##把没有用户身份的用户都映射为guest账号
321 guest ok = yes ##此共享允许guset用户访问
ip:72
[root@rtt ~]# smbclient //172.25.254.100/westos_share ##匿名用户可以直接访问
Enter SAMBA\root's password: ##不需要输入密码
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Tue Aug 10 23:31:13 2021
.. D 0 Tue Aug 10 12:01:23 2021
westosfile1 N 0 Tue Aug 10 12:15:06 2021
westosfile2 N 0 Tue Aug 10 12:15:06 2021
westosfile3 N 0 Tue Aug 10 12:15:06 2021
file A 0 Tue Aug 10 23:31:13 2021
17814528 blocks of size 1024. 14385736 blocks available
######autofs+samba#########
autofs:
在客户端实现自动挂载卸载的软件
配置方式:
vim /etc/auto.master
最终挂载点的上层目录 自动以子策略文件
/mnt /etc/auto.samba
vim 自动以子策略文件(/etc/auto.samba)
最终挂载点 挂载参数 挂载资源
samba -fstype=cifs,username=westos,password=lee ://172.25.254.20/westosdirsystemctl restart autofs
测试:
cd /westos/samba
df
cd /root
等待资源闲置超时 ##默认300秒 vim /etc/autofs.conf ---->Timeout=3
df
挂载资源自动卸载
//172.25.254.100/westos_share /westos/samba 在/westos/samba底下,实现自动挂载和卸载westos_share
dnf install autofs -y ##在客户端安装 autofs 实现自动挂载和卸载
vim /etc/auto.master
/westos /etc/auto.share ##/westos 最终挂载点的上层目录,etc/auto.master 子挂载策略文件,此文件名称自定义,并且在系统中默认不存在
vim /etc/auto.share
samba -fstype=cifs,username=westos,password=westos ://172.25.254.100/westos_share ##samba最终挂载点的相对路径
systemctl enable --now autofs.service
ls -ld /westos
cd /westos/samba
df ##自动挂载
vim /etc/autofs.conf
timeout = 5 ##autofs的配置文件,设置自动挂载等待时间为 5s
systemctl restart autofs
cd ##转到非挂载路径
df ##不显示挂载
cd /westos/samba ##转到挂载路径等待5s
df ##自动挂载
####8.samba的多用户挂载#####
在客户端中root用户用自己的samba账户挂载了服务器的资源,自己时可以浏览使用的。
但没有用过samba验证的其他人也可以访问samba服务,这样客户端就出现了很严重的越级漏洞。
dnf install cifs-utils -y ##安装多用户的安全插件
man mount.cifs ##查看安全插件的用法vim /root/smbpass
username=westos
password=leemount -o credentials=/root/smbpass,sec=ntlmssp,multiuser //172.25.254.20/westosdir /mnt
#credentials=/root/smbpass 指定认证文件
#sec=ntlmssp 指定认证类型 用户使用到的认证方式
#multiuser 多用户认证参数,当挂载时添加此参数,没有通过认证的用户不可以使用 smb上的资源
dnf install cifs-utils -y ##安装多用户的安全插件
man mount.cifs ##查看安全插件的用法
vim /root/smbpass
username=lee
password=westos
chmod 600 /root/smbpass ##当用户挂载smb资源时需要书写账号密码,如果直接书写,那账号密码用过历史则被其他人看到,所以要写到文件中,并设定安全权限
mount -o credentials=/root/smbpass //172.25.254.100/westos_share /mnt ##用credentials参数指定文件,密码将被隐藏
umount /mnt
mount -o credentials=/root/smbpass,multiuser //172.25.254.100/westos_share /mnt ##multiuser 多用户认证参数,当挂载时加此参数,没有通过认证的用户不可以使用smb上的资源
su - westos
ls /mnt
ls: cannot access '/mnt': Permission denied
umount /mnt
mount -o credentials=/root/smbpass,multiuser,set=ntlmssp //172.25.254.100/westos_share /mnt ##set=ntlmssp用户使用的认证方式
su - westos
cifscreds add -u lee 172.25.254.100
Password: ##当输入密码错误时
ls /mnt
ls: cannot access '/mnt': Permission denied ##访问依然被拒绝
cifscreds --help
Usage:
cifscreds add [-u username] [-d] <host|domain>
cifscreds clear [-u username] [-d] <host|domain>
cifscreds clearall
cifscreds update [-u username] [-d] <host|domain>
cifscreds clearall ##清空添加的密码
cifscreds add -u lee 172.25.254.100
Password: ##输入正确密码
ls /mnt
westosfile1 westosfile2 westosfile3 ##用户可以使用smb资源 ##
####NFS####
Net File System
####nfs基本信息####
nfs-utils ##安装包
nfs-server ##服务脚本/etc/exports ##共享配置文件
下载:
dnf install nfs-utils.x86_64 -y
netstat -antlupe | grep 2049 ##nfs的端口
####nfs的启用####
nfs的启用:
systemctl start nfs-server
firewall-cmd --permanent --add-service=rpc-bind ##rpc-bind 给我们的访问请求提供一个端口
firewall-cmd --permanent --add-service=mountd ##
firewall-cmd --permanent --add-service=nfs
firewall-cmd --reload
启动:
109 dnf search nfs
110 dnf install nfs-utils.x86_64 -y
113 systemctl enable --now nfs-server ##单纯的启动nfs启动不成功
114 firewall-cmd --permanent --add-service=rpc-bind
115 firewall-cmd --permanent --add-service=mountd ##rpc-bind mountd都进行启动才可以启动nfs
116 firewall-cmd --permanent --add-service=nfs
firewall-cmd --reload ##进行重新加载
117 netstat -antlupe | grep 2049 ##nfs端口
测试(在测试机200上测试):
showmount -e 172.25.254.100 ##列出nfs服务器中的共享资源
Export list for 172.25.254.100:
####nfs配置####
常用参数
anonuid=1000,anongid=1000 ##指定用户身份
sync ##更改生成后同步数据到服务器,占用内存小
async ##时时同步数据到服务器,占用内存大
rw ##读写
ro ##只读
no_root_squash ##root用户挂载不转换身份man 5 exports ##可以查看共享策略文件的书写参数和共享书写参数
服务器ip:100
mkdir /westosdir
ls -ld /westosdir/
drwxr-xr-x. 2 root root 6 Aug 11 09:37 /westosdir/
chmod 777 /westosdir/ ##建立共享文件并设定权限
vim /etc/exports ##编辑共享策略文件
/westosdir *(ro,sync) # ro只读共享,并在数据发生改变后同步到nfs共享目录
exportfs -rv ##使得共享策略生效
touch /westosdir/westosfile{1..3}
客户端ip:200
showmount -e 172.25.254.100 ##客户端可以查看到共享
ls /mnt
westosfile1 westosfile2 westosfile3
##########################
/westosdir *(ro,sync) 172.25.254.200(rw,sync)
mount 172.25.254.100:/westosdir /mnt ##共享资源使用方式
touch /mnt/westosfile4
ls -ld /westosdir/* ##显示用户为 nobaby
-rw-r--r--. 1 nobody nobody 0 Aug 11 10:11 /westosdir/westosfile4
################################
/westosdir *(ro,sync) 172.25.254.200(rw,sync,anonuid=1000,anongid=1000)
umount /mnt
mount 172.25.254.100:/westosdir /mnt
touch /mnt/westosfile5
ls -ld /westosdir/*
-rw-r--r--. 1 westos westos 0 Aug 11 10:16 /westosdir/westosfile5
/westosdir *(ro,sync) 172.25.254.200(rw,sync,no_root_squash)
##################################
umount /mnt
mount 172.25.254.100:/westosdir /mnt
touch /mnt/westosfile6
ls -ld /westosdir/*
-rw-r--r--. 1 root root 0 Aug 11 10:17 /westosdir/westosfile6
##########nfs+autofs#######
在客户端实现自动挂载卸载的软件
//172.25.254.100/westosdir /westos/nfs 在/westos/nfs底下,实现自动挂载和卸载westosdir
配置方式:
vim vim /etc/auto.master ##编辑主挂载策略文件
8 #/westos /etc/auto.share #将之前samba注释掉,不然影响当前实验
9 /westos /etc/auto.nfs #/westos最终挂载点的上层目录 /etc/auto.nfs子策略文件
vimvim /etc/auto.nfs ##编辑子策略文件,默认文件不存在,需要自行建立
1 nfs 172.25.254.100:/westosdir # nfs最终挂载点 172.25.254.100:/westosdir nfs服务器上共享出来的资源
syssystemctl restart autofs.service ##重新加载 autofs 服务
测试:
[root@westoslinux ~]# ls /westos ##查看westos下的共享文件,显示没有
[root@westoslinux ~]# cd /westos/nfs
[root@westoslinux nfs]# ls ##转到westos下的nfs,显示共享文件
westosfile1 westosfile2 westosfile3 westosfile4 westosfile5 westosfile6
[root@westoslinux nfs]# df ##查看有无自动挂载,显示则自动挂载成功
172.25.254.100:/westosdir 17814528 3377408 14437120 19% /mnt
#######iscsi#########
iscsi:共享设备
服务器:1.
fdisk /dev/vdb -------> /dev/vdb12.
dnf install targetcli -y3.
iscsi_server
targetcli
/> /backstores/block create westos_storage1 /dev/vdb1
/> /iscsi create iqn.2020-08.com.westos:strage1 ##IQN Iscsi Qualified Name
/> /iscsi/iqn.2020-08.com.westos:strage1/tpg1/luns create /backstores/block/westos_storage1
/> /iscsi/iqn.2020-08.com.westos:strage1/tpg1/acls create iqn.2020-08.com.westos:westoskey1
/> exit
4.
iscsi_client客户端:
dnf install iscsi-initiator-utils.x86_64 -y
vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2020-08.com.westos:westoskey1 <---- key checksystemctl restart iscsid
iscsiadm -m discory -t st -p 172.25.254.100
iscsiadm -m node -T iqn.2020-08.com.westos:strage1 -p 172.25.254.100 -l ---> /dev/sdafdisk /dev/sda ---> /dev/sda1
mkfs.xfs /dev/sda1
mount /dev/sda1 /mnt
1.服务端添加一个磁盘
服务端ip100:
fdisk -l
Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 sectors ##显示第二磁盘
fdisk /dev/vdb ##进行分盘
Command (m for help): n
Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): +2G
Command (m for help): p
Device Boot Start End Sectors Size Id Type
/dev/vdb1 2048 4196351 4194304 2G 83 Linux
Command (m for help): wq
#####################
dnf install targetcli -y ##共享策略管理软件
systemctl enable --now target
targetcli ##用此命令编写共享策略
ls
/> /backstores/block create westos:storagel /dev/vdb1 #westos:storagel此软件中设备的别名 /dev/vdb1真实设备
/> /iscsi create iqn.2021-08.org.westos:storage1 ##建立对外的共享名称,iqn的命令方式 iscsi限制名称 格式 iqn.YYYY-MM. org.westos域名反写 :storage1别名
/> iscsi/iqn.2021-08.org.westos:storage1/tpg1/luns create /backstores/block/westos:storagel #把共享名称和内部指定设备关联
/> iscsi/iqn.2021-08.org.westos:storage1/tpg1/acls create iqn.2021-08.org.westos:westoskey #为共享设备设定访问kry westoskey加密字符
/> exit
firewall-cmd --permanent --add-port=3260/tcp ##设定火墙 开放服务器的端口,让客户端访问
firewall-cmd --reload
客户端ip:200
dnf search iscsi ##客户端软件
dnf install iscsi-initiator-utils.x86_64 -y
systemctl status iscsid ##对客户端配置控制服务
systemctl status iscsi ##客户端对于资源利用的服务
iscsiadm -m discovery -t st -p 172.25.254.100 ##-m mode,-t 指定要识别的设别理性,-p 指定资源主机ip 访问服务器
172.25.254.100:3260,1 iqn.2021-08.org.westos:storage1 ##共享信息可以查询
vim /etc/iscsi/initiatorname.iscsi ##在此文件中指定共享key
InitiatorName=iqn.2021-08.org.westos:westoskey #服务器中的共享key
systemctl restart iscsid
iscsiadm -m node -T iqn.2021-08.org.westos:storage1 -p 172.25.254.100 -l ## -T 指定要访问的共享设备名称,-l 登陆共享设备
Logging in to [iface: default, target: iqn.2021-08.org.westos:storage1,
portal:172.25.254.100,3260]
Login to [iface: default, target: iqn.2021-08.org.westos:storage1,
portal: 172.25.254.100,3260] successful. ##登陆共享设备成功
在客户端进行测试:
fdisk -l
Disk /dev/sda: 2 GiB, 2147483648 bytes, 4194304 sectors ##子系统中会出现新的硬盘大小,为服务器中共享的设备大小
[root@westoslinux nfs]# mount /dev/sda1 /mnt
mount: /mnt: special device /dev/sda1 does not exist.
[root@westoslinux nfs]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x238150eb.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-4194303, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-4194303, default 4194303):
Created a new partition 1 of type 'Linux' and of size 2 GiB.
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@westoslinux nfs]# mkfs.xfs /dev/sda1
meta-data=/dev/sda1 isize=512 agcount=4, agsize=131008 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=524032, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@westoslinux nfs]# mount /dev/sda1 /mnt
[root@westoslinux nfs]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 403532 0 403532 0% /dev
tmpfs 419132 0 419132 0% /dev/shm
tmpfs 419132 6676 412456 2% /run
tmpfs 419132 0 419132 0% /sys/fs/cgroup
/dev/vda3 17814528 3345576 14468952 19% /
/dev/vda1 1038336 173172 865164 17% /boot
tmpfs 83824 1180 82644 2% /run/user/42
tmpfs 83824 32 83792 1% /run/user/0
/dev/sda1 2085888 47580 2038308 3% /mnt
172.25.254.100:/westosdir 17814528 3383808 14430720 19% /westos/nfs
永久挂载:
blkid ##网络设备因为网络通信的缘故可能发生名称变化,所以推荐挂载时用 设备id 进行设备指定
vim /etc/fstab
UUID=62f69d75-abe0-4c6b-a59c-dd69b6f80965 /mnt xfs defaults,_netdev 0 0 ##_netdev 指定此设备在挂载时先启动网络和iscsi服务后再生效
########卸载共享硬盘###########
客户端卸载:
vim /etc/fstab ##删掉网络设备的自动挂载信息
umount /mnt ##进行卸载,但还是存在
fdisk -l
tree /var/lib/iscsi/ ##在客户端读取到的服务器的所有数据存放目录
iscsiadm -m node -T iqn.2021-08.org.westos:storage1 -p 172.25.254.100 -u ## -u退出登陆
fdisk -l ##不存在
tree /var/lib/iscsi/ ##数据还是显示,重启iscsi服务设备会自动出现
iscsiadm -m node -T iqn.2021-08.org.westos:storage1 -p 172.25.254.100 -o delete ##删除客户主机中此网络设备的数据,客户端将永久卸载
fdisk -l ##不存在
tree /var/lib/iscsi/ ##不显示
服务器卸载:
targetcli
ls
help
clearconfig confirm=True ##清空服务器中iscsi的共享数据
ls ##彻底卸载