The Linux user login management (/etc/passwd and /etc/shadow files)

原文出自: https://www.ibm.com/developerworks/mydeveloperworks/blogs/58e72888-6340-46ac-b488-d31aa4058e9c/entry/the_linux_user_login_management_etc_passwd_and_etc_shadow_files19?lang=en


概要:

文章介紹了passwd和shadow文件以及他們的格式,

passwd:雖然名字看起來很像是password但是他並不包含password,正真的password在shadow裏面,這個主要包括如下的一些用戶信息

        User-Name / Encrypted password entry /User Id (UID) /Group Id (GID) /Home directory /shell

shadow:包含了password和其他一些相關的時間信息

  • Login name
  • The corresponding Encrypted password
  • Number of days since 1st Jan 1970, that password was last changed
  • Number of days before password may be changed
  • Number of days after which password has to be changed
  • Number of days before password expiry warning starts popping up
  • Number of days after password expires that account is disabled
  • Number of days since 1st Jan 1970, that account is disabled
  • Reserved field for further use. 




Have you ever thought what happens behind the doors when a user login happens in Linux? Where is the login information for a user is kept in Linux and how the validation of user credential takes place? Well, if not, then I would suggest you to read on as in this article we will discuss how user login management and validation takes place in Linux.
 

The /etc/passwd file

Well, this is the file in Linux system that contains all the relevant information related to user login. If we peek inside this file, this is what it looks like on my Linux mint box:
 
$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
syslog:x:101:103::/home/syslog:/bin/false
messagebus:x:102:107::/var/run/dbus:/bin/false
avahi-autoipd:x:103:110:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false
avahi:x:104:111:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
couchdb:x:105:113:CouchDB Administrator,,,:/var/lib/couchdb:/bin/bash
speech-dispatcher:x:106:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh
usbmux:x:107:46:usbmux daemon,,,:/home/usbm
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章