bash - Can anyone tell me what :x: is used for? -


could tell me :x: used for? i've searched web not many results. example following:

`grep $user:x: /etc/passwd' 

thanks, dave

$user:x: pattern give grep search in /etc/passwd. return lines containing $user:x:, $user user working in shell. hence, command return line in /etc/passwd in user defined.

if check how /etc/passwd file stored see 2nd block x, meaning password encrypted , stored in /etc/shadow file. in old machines password stored in /etc/passwd, changed because file readable user, while /etc/shadow root.

that said, using $user:x assure matching user. in fact, ^$user: suffice, because : cannot present in user name.

an alternative use awk example:

awk -f: -v user=$user '$1==user' /etc/passwd 

see graphical explanation of /etc/passwd (sorry bit big!! couldn't find other smaller in english):

enter image description here


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -