2008年5月5日 星期一

unix password/shadow management

If the /etc/shadow file contains the following token in the second field
* (we can manually put this character by pre-fixing the encrypted string with an *)
! (by using the passwd –l user_name)

user1:*$1$sdiv6Jjp$FG6IYJ4ziL8KLLfo0f8oK/:13876:0:99999:7::: ==> We can put the prefix character (*) to disable the specified user.
user2:!!:14004:0:99999:7::: ==> When we create a new user without changing the default password. The user data in the shadow file will have the prefix character (!) in the second field.

http://nmc.nchu.edu.tw/linux/User_mng.htm
停用一個帳號

方式一 : With UNIX Command
passwd –l user_name
-l This option is used to lock the specified account and it is available to root only. The locking is performed by rendering the encrypted password into an invalid string (by pre-fixing the encrypted string with an !).

方式二 : 手動停用
停用一個帳號非常簡單,只需將/etc/shadow該user的帳號的password欄
位用字元"*"取代之即可。例如你要停用帳號woody,只需把/etc/passwd
中woody這一行改成向下面這個樣子即可:
woody:*:501:100:woody:/home/woody:/bin/tcsh

沒有留言: