国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > Linux > 正文

Linux上查看用戶創(chuàng)建日期的幾種方法總結(jié)

2024-08-28 00:02:07
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

前言

你知道嗎,如何在 Linux 系統(tǒng)上查看帳戶的創(chuàng)建日期?如果知道,那么有些什么辦法。

你成功了么?如果是的話,該怎么做?

基本上 Linux 系統(tǒng)不會(huì)跟蹤這些信息,因此,獲取這些信息的替代方法是什么?

你可能會(huì)問(wèn)為什么我要查看這個(gè)?

是的,在某些情況下,你可能需要查看這些信息,那時(shí)就會(huì)對(duì)你會(huì)有幫助。

可以使用以下 7 種方法進(jìn)行驗(yàn)證。

使用 /var/log/secure 使用 aureport 工具 使用 .bash_logout 使用 chage 命令 使用 useradd 命令 使用 passwd 命令 使用 last 命令

方式 1:使用 /var/log/secure

它存儲(chǔ)所有安全相關(guān)的消息,包括身份驗(yàn)證失敗和授權(quán)特權(quán)。它還會(huì)通過(guò)系統(tǒng)安全守護(hù)進(jìn)程跟蹤 sudo 登錄、SSH 登錄和其他錯(cuò)誤記錄。

# grep prakash /var/log/secureApr 12 04:07:18 centos.2daygeek.com useradd[21263]: new group: name=prakash, GID=501Apr 12 04:07:18 centos.2daygeek.com useradd[21263]: new user: name=prakash, UID=501, GID=501, home=/home/prakash, shell=/bin/bashApr 12 04:07:34 centos.2daygeek.com passwd: pam_unix(passwd:chauthtok): password changed for prakashApr 12 04:08:32 centos.2daygeek.com sshd[21269]: Accepted password for prakash from 103.5.134.167 port 60554 ssh2Apr 12 04:08:32 centos.2daygeek.com sshd[21269]: pam_unix(sshd:session): session opened for user prakash by (uid=0)

方式 2:使用 aureport 工具

aureport 工具可以根據(jù)記錄在審計(jì)日志中的事件記錄生成匯總和柱狀報(bào)告。默認(rèn)情況下,它會(huì)查詢 /var/log/audit/ 目錄中的所有 audit.log 文件來(lái)創(chuàng)建報(bào)告。

# aureport --auth | grep prakash46. 04/12/2018 04:08:32 prakash 103.5.134.167 ssh /usr/sbin/sshd yes 28847. 04/12/2018 04:08:32 prakash 103.5.134.167 ssh /usr/sbin/sshd yes 291

方式 3:使用 .bash_logout

家目錄中的 .bash_logout 對(duì) bash 有特殊的含義,它提供了一種在用戶退出系統(tǒng)時(shí)執(zhí)行命令的方式。

我們可以查看用戶家目錄中 .bash_logout 的更改日期。該文件是在用戶第一次注銷(xiāo)時(shí)創(chuàng)建的。

# stat /home/prakash/.bash_logout File: `/home/prakash/.bash_logout' Size: 18 Blocks: 8 IO Block: 4096 regular fileDevice: 801h/2049d Inode: 256153 Links: 1Access: (0644/-rw-r--r--) Uid: ( 501/ prakash) Gid: ( 501/ prakash)Access: 2017-03-22 20:15:00.000000000 -0400Modify: 2017-03-22 20:15:00.000000000 -0400Change: 2018-04-12 04:07:18.283000323 -0400

方式 4:使用 chage 命令

chage 意即 “change age”。該命令讓用戶管理密碼過(guò)期信息。chage 命令可以修改上次密碼更改日期后需要更改密碼的天數(shù)。

系統(tǒng)使用此信息來(lái)確定用戶何時(shí)必須更改其密碼。如果用戶自帳戶創(chuàng)建日期以來(lái)沒(méi)有更改密碼,這個(gè)就有用。

# chage --list prakashLast password change : Apr 12, 2018Password expires : neverPassword inactive : neverAccount expires : neverMinimum number of days between password change : 0Maximum number of days between password change : 99999Number of days of warning before password expires : 7

方式 5:使用 useradd 命令

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 丰都县| 安徽省| 克拉玛依市| 新干县| 都江堰市| 尼玛县| 册亨县| 全南县| 南涧| 肇州县| 山阴县| 化德县| 天津市| 大邑县| 华阴市| 大埔区| 峨眉山市| 剑河县| 天祝| 松潘县| 印江| 米泉市| 黄石市| 大竹县| 景德镇市| 池州市| 杂多县| 同江市| 中山市| 赞皇县| 寿光市| 眉山市| 旅游| 如皋市| 齐齐哈尔市| 汝州市| 老河口市| 铜鼓县| 乐昌市| 南平市| 泽州县|