第6章系统数据文件和信息总结
生活随笔
收集整理的這篇文章主要介紹了
第6章系统数据文件和信息总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 口令文件的shell字段
如果是空,則使用系統默認的shell,一般是/bin/sh
/dev/null:阻止對應的用戶名登陸系統
/bin/false:同樣是阻止特定用戶登錄,以不成功狀態終止
/bin/true:阻止特定用戶登錄,以成功狀態終止
2 獲取口令文件內容的函數
通過用戶ID或用戶名可以獲取該用戶在口令文件中的對應項
struct passwd* getpwuid(uid_t uid)struct passwd* getpwnam(const char *name)獲取整個口令文件內容:
struct passwd *getpwent()示例:
struct passwd *a; printf("name\tpasswd\tshell\n"); while( (a = getpwent()) != NULL) {printf("%s\t%s\t%s\n",a->pw_name,a->pw_passwd,a->pw_shell); } endpwent();調用getpwent函數時,一定要調用endpwent函數關閉
在getpwent之前調用setpwent可以反繞口令文件,使定位到口令文件開始處,防止口令文件已經被getpwent掉用過
3 陰影口令
關于陰影口令有一組與口令文件類似的函數:
struct spwd *getspnam(const char *name)struct spwd *getspent()void setspent()void endspent()?
轉載于:https://www.cnblogs.com/buptlyn/p/4142406.html
總結
以上是生活随笔為你收集整理的第6章系统数据文件和信息总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《python cookbook》cha
- 下一篇: java信息管理系统总结_java实现科