查询login什么时候过期

Posted kala

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了查询login什么时候过期相关的知识,希望对你有一定的参考价值。

-- Show all logins where the password is over 60 days old

--查看60天没改密码的login

SELECT name, LOGINPROPERTY([name], ‘PasswordLastSetTime‘) AS ‘PasswordChanged‘
FROM sys.sql_logins
WHERE LOGINPROPERTY([name], ‘PasswordLastSetTime‘) < DATEADD(dd, -60, GETDATE());

   

From <https://www.mssqltips.com/sqlservertip/2379/auditing-sql-server-password-age/>

  

查询login什么时候过期

   

 1 SELECT LOGINPROPERTY(name, BadPasswordCount) AS BadPasswordCount name,
 2 ,LOGINPROPERTY(name, BadPasswordTime) AS BadPasswordTime
 3 ,LOGINPROPERTY(name, DaysUntilExpiration) AS DaysUntilExpiration
 4 ,LOGINPROPERTY(name, DefaultDatabase) AS DefaultDatabase
 5 ,LOGINPROPERTY(name, DefaultLanguage) AS DefaultLanguage
 6 ,LOGINPROPERTY(name, HistoryLength) AS HistoryLength
 7 ,LOGINPROPERTY(name, IsExpired) AS IsExpired
 8 ,LOGINPROPERTY(name, IsLocked) AS IsLocked
 9 ,LOGINPROPERTY(name, IsMustChange) AS IsMustChange
10 ,LOGINPROPERTY(name, LockoutTime) AS LockoutTime
11 ,LOGINPROPERTY(name, PasswordHash) AS PasswordHash
12 ,LOGINPROPERTY(name, PasswordLastSetTime) AS PasswordLastSetTime
13 ,LOGINPROPERTY(name, PasswordHashAlgorithm) AS PasswordHashAlgorithm
14 ,is_expiration_checked        As is_expiration_checked
15 FROM sys.sql_logins
16 WHERE is_policy_checked = 1

 

   

window sid:

net user username /domain

   

   

关于Password Policy详细解释

   

https://technet.microsoft.com/en-us/library/dd277399.aspx

   



以上是关于查询login什么时候过期的主要内容,如果未能解决你的问题,请参考以下文章

如何使控制台中的视图缓存片段过期?

Linux账户密码过期安全策略设置

详解三种缓存过期策略LFU,FIFO,LRU(附带实现代码)

linux设置密码过期时间/etc/login.defs

大查询数据过期

PHP+MYSQL怎么查询3天后到期的字段