自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何在Linux上查看用戶的創(chuàng)建日期

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

[[228894]]

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

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

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

你可能會問為什么我要查看這個?

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

可以使用以下 7 種方法進行驗證。

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

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

它存儲所有安全相關的消息,包括身份驗證失敗和授權特權。它還會通過系統(tǒng)安全守護進程跟蹤 sudo 登錄、SSH 登錄和其他錯誤記錄。

  1. # grep prakash /var/log/secure

  2. Apr 12 04:07:18 centos.2daygeek.com useradd[21263]: new group: name=prakash, GID=501

  3. Apr 12 04:07:18 centos.2daygeek.com useradd[21263]: new user: name=prakash, UID=501, GID=501, home=/home/prakash, shell=/bin/bash

  4. Apr 12 04:07:34 centos.2daygeek.com passwd: pam_unix(passwd:chauthtok): password changed for prakash

  5. Apr 12 04:08:32 centos.2daygeek.com sshd[21269]: Accepted password for prakash from 103.5.134.167 port 60554 ssh2

  6. Apr 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ù)記錄在審計日志中的事件記錄生成匯總和柱狀報告。默認情況下,它會查詢 /var/log/audit/ 目錄中的所有 audit.log 文件來創(chuàng)建報告。

  1. # aureport --auth | grep prakash

  2. 46. 04/12/2018 04:08:32 prakash 103.5.134.167 ssh /usr/sbin/sshd yes 288

  3. 47. 04/12/2018 04:08:32 prakash 103.5.134.167 ssh /usr/sbin/sshd yes 291 

方式 3:使用 .bash_logout

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

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

  1. # stat /home/prakash/.bash_logout

  2. File: `/home/prakash/.bash_logout'

  3. Size: 18 Blocks: 8 IO Block: 4096 regular file

  4. Device: 801h/2049d Inode: 256153 Links: 1

  5. Access: (0644/-rw-r--r--) Uid: ( 501/ prakash) Gid: ( 501/ prakash)

  6. Access: 2017-03-22 20:15:00.000000000 -0400

  7. Modify: 2017-03-22 20:15:00.000000000 -0400

  8. Change: 2018-04-12 04:07:18.283000323 -0400 

方式 4:使用 chage 命令

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

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

  1. # chage --list prakash

  2. Last password change : Apr 12, 2018

  3. Password expires : never

  4. Password inactive : never

  5. Account expires : never

  6. Minimum number of days between password change : 0

  7. Maximum number of days between password change : 99999

  8. Number of days of warning before password expires : 7 

方式 5:使用 useradd 命令

useradd 命令用于在 Linux 中創(chuàng)建新帳戶。默認情況下,它不會添加用戶創(chuàng)建日期,我們必須使用 “備注” 選項添加日期。

  1. # useradd -m prakash -c `date +%Y/%m/%d`

  2.  

  3. # grep prakash /etc/passwd

  4. prakash:x:501:501:2018/04/12:/home/prakash:/bin/bash 

方式 6:使用 passwd 命令

passwd 命令用于將密碼分配給本地帳戶或用戶。如果用戶在帳戶創(chuàng)建后沒有修改密碼,那么可以使用 passwd 命令查看***一次密碼修改的日期。

  1. # passwd -S prakash

  2. prakash PS 2018-04-11 0 99999 7 -1 (Password set, MD5 crypt.) 

方式 7:使用 last 命令

last 命令讀取 /var/log/wtmp,并顯示自該文件創(chuàng)建以來所有登錄(和退出)用戶的列表。

  1. # last | grep "prakash"

  2. prakash pts/2 103.5.134.167 Thu Apr 12 04:08 still logged in

責任編輯:龐桂玉 來源: Linux中國
相關推薦

2020-04-01 12:42:01

Linux用戶密碼到期日期

2022-11-01 15:49:52

2018-07-20 14:20:24

Linux用戶組管理員

2023-06-25 18:52:48

2020-01-10 16:45:05

LinuxWindows 10USB

2016-11-23 08:48:24

LinuxCalibre電子書

2019-05-29 08:00:00

Linux計劃任務cron

2019-09-16 11:40:49

Linux交換文件

2019-11-18 10:00:05

Linux桌面添加用戶

2020-04-21 14:21:31

LinuxPython

2018-12-11 11:00:50

Linux字體命令

2021-10-02 10:10:47

LinuxBusyBox命令

2021-10-12 08:43:19

LinuxSambaWindows

2020-03-23 17:58:29

LinuxSSH

2021-01-18 08:00:00

Linux虛擬機磁盤

2016-01-04 15:17:50

Linux命令行硬件

2016-11-24 09:22:20

Linux時區(qū)NTP服務器

2014-05-30 10:50:51

iOS捕捉簽名

2019-01-07 09:50:06

Linuxtarball命令

2019-11-26 16:58:51

Linuxpkgsrc
點贊
收藏

51CTO技術棧公眾號