gecco
(Carlo Minucci)
1
itβs possible to know the date of creation of an user via shell?
[root@server Template]# db accounts show minucci
minucci=user
City=
Company=
Department=
FirstName=Carlo
LastName=Minucci
MailForwardStatus=disabled
MailQuotaType=default
MailSpamRetentionStatus=disabled
MailStatus=enabled
PassExpires=yes
PhoneNumber=
Samba=enabled
Shell=/usr/libexec/openssh/sftp-server
Street=
Uid=5475
__state=active
[root@server Template]#
with db account command there is not this information
i need to found all user old more than 5 years then delete it
how can you have an 5 years old account on NS?
giacomo
(Giacomo Sanchietti)
4
This query searches for all users and print the related creation timestamp:
ldapsearch -Y EXTERNAL '(objectClass=posixAccount)' createTimestamp
If you wish to check the condition directly into ldap query, ake a look at this: http://stackoverflow.com/questions/19021421/user-account-creation-date-in-ldap
3 Likes
gecco
(Carlo Minucci)
5
ok! this work butβ¦ donβt work
i try to explain
[root@server etc]# ldapsearch -Y EXTERNAL β(objectClass=posixAccount)β createTimestamp | tr -d β\nβ | tr -s β#β β\nβ | grep People | awk β{print $5 " " $1}β | grep minucci
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
20150825100712Z minucci,
i search for my username
but if i search for an username create now, donβt work
[root@server etc]# ldapsearch -Y EXTERNAL β(objectClass=posixAccount)β createTimestamp | tr -d β\nβ | tr -s β#β β\nβ | grep People | awk β{print $5 " " $1}β | grep sostegno
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
but user exist
[root@server etc]# db accounts show sostegno
sostegno=user
City=
Company=
Department=
FirstName=Corso
LastName=Sostegno
MailForwardStatus=disabled
MailQuotaType=default
MailSpamRetentionStatus=disabled
MailStatus=enabled
PassExpires=yes
PhoneNumber=
Samba=enabled
Street=
Uid=6096
__state=active
in other way
[> root@server etc]# getent passwd | grep minucci
minucci:x:5475:5475:Carlo Minucci:/var/lib/nethserver/home/minucci:/usr/libexec/openssh/sftp-server
[root@server etc]# getent passwd | grep sostegno
[root@server etc]#
an again
[root@server etc]# ldapsearch -Y EXTERNAL β(objectClass=posixAccount)β createTimestamp | tr -d β\nβ | tr -s β#β β\nβ | wc -l
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
508
[root@server etc]# db accounts print | wc -l
1811
[root@server etc]# db accounts print | grep user | wc -l
836
[root@server etc]#
itβs a problem in my mind?
1 Like