分类目录归档:Linux

iscsiadm简单使用

配置iSCSI Initiator
— 安装initiator
# yum -y install iscsi-initiator-utils
设置开机启动
# chkconfig iscsid on
# chkconfig iscsi on

–设置InitiatorName
[root@ntsmsdb1 ~]# vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2015-03.com.palmyou:tdxt2015

–配置iscsi存储
[root@ntsmsdb1 ~]# iscsiadm -m discovery -d 2 -t st -p 10.168.200.240
10.168.200.240:3260,1 iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak
[root@ntsmsdb1 ~]# iscsiadm -m node -T iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak –login
Logging in to [iface: default, target: iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak, portal: 10.168.200.240,3260] (multiple)
Login to [iface: default, target: iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak, portal: 10.168.200.240,3260] successful.

[root@ntsmsdb1 ~]# iscsiadm -m node –T iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak -p 110.168.200.240 –op update -n node.startup -v automatic

–卸载iscsi存储
[root@ntsmsdb1 ~]# iscsiadm -m node –logoutall=all
Logging out of session [sid: 2, target: iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak, portal: 10.168.200.240,3260]
Logging out of session [sid: 3, target: iqn.2001-05.com.equallogic:0-1cb196-dc6282933-5e19fee090c5513d-tdxtdb, portal: 10.168.200.244,3260]
Logout of [sid: 2, target: iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak, portal: 10.168.200.240,3260] successful.
Logout of [sid: 3, target: iqn.2001-05.com.equallogic:0-1cb196-dc6282933-5e19fee090c5513d-tdxtdb, portal: 10.168.200.244,3260] successful.

[root@ntsmsdb1 ~]# iscsiadm -m node –op delete –targetname iqn.2001-05.com.equallogic:0-1cb196-162e52606-a7300000ca95513d-tdxtdbbak
[root@ntsmsdb1 ~]# iscsiadm -m node –op delete –targetname iqn.2001-05.com.equallogic:0-1cb196-dc6282933-5e19fee090c5513d-tdxtdb
[root@ntsmsdb1 ~]#
–iscsi操作总结
增加iscsi存储
(1)发现iscsi存储:iscsiadm -m discovery -t st -p ISCSI_IP
(2)查看iscsi发现记录:iscsiadm -m node
(3)登录iscsi存储:iscsiadm -m node -T LUN_NAME -p ISCSI_IP -l
(4)开机自动: iscsiadm -m node –T LUN_NAME -p ISCSI_IP –op update -n node.startup -v automatic

删除iscsi存储
(1)登出iscsi存储 iscsiadm -m node -T LUN_NAME -p ISCSI_IP -u
(2)对出iscsi所有登录 iscsiadm -m node –logoutall=all
(3)删除iscsi发现记录:iscsiadm -m node -o delete -T LUN_NAME -p ISCSI_IP

登入需验证码的节点
(1)开启认证
iscsiadm -m node -T LUN_NAME -o update –name node.session.auth.authmethod –value=CHAP
*.使用-o同–op
(2)添加用户
iscsiadm -m node -T LUN_NAME –op update –name node.session.auth.username –value=[用户名]
(3)添加密码
iscsiadm –m node –T LUN_NAME –op update –name node.session.auth.password –value=[密码]

Linux无法登录,显示module is unknown

早上有个同事反映使用vmware控制台登陆某台Centos操作系统时,出现无法登录,并显示一闪而过的错误信息module is unknown,用户名与密码均正确,使用ssh命令行工具是可以登陆的。

于是检查日志信息如下:

[root@ntsmsdb1 log]# tail -200f /var/log/secure

Jun 4 09:41:28 ntsmsdb1 login: PAM adding faulty module: /lib/security/pam_limits.so
Jun 4 09:42:04 ntsmsdb1 unix_chkpwd[2571]: password check failed for user (root)
Jun 4 09:42:04 ntsmsdb1 login: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost= user=root
Jun 4 09:42:05 ntsmsdb1 login: FAILED LOGIN 1 FROM (null) FOR root, Authentication failure
Jun 4 09:42:10 ntsmsdb1 login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Jun 4 09:42:10 ntsmsdb1 login: Module is unknown
Jun 4 09:42:12 ntsmsdb1 login: PAM unable to dlopen(/lib/security/pam_limits.so): /lib/security/pam_limits.so: cannot open shared object file: No such file or directory
Jun 4 09:42:12 ntsmsdb1 login: PAM adding faulty module: /lib/security/pam_limits.so
Jun 4 09:42:14 ntsmsdb1 login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Jun 4 09:42:14 ntsmsdb1 login: Module is unknown
Jun 4 10:05:56 ntsmsdb1 sshd[2266]: pam_unix(sshd:session): session closed for user root
Jun 4 10:08:43 ntsmsdb1 login: PAM unable to dlopen(/lib/security/pam_limits.so): /lib/security/pam_limits.so: cannot open shared object file: No such file or directory
Jun 4 10:08:43 ntsmsdb1 login: PAM adding faulty module: /lib/security/pam_limits.so
Jun 4 10:08:44 ntsmsdb1 login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Jun 4 10:08:45 ntsmsdb1 login: Module is unknown

解决办法:

session required /lib/security/pam_limits.so 修改为==》
session required /lib64/security/pam_limits.so