-1

What command should I use to get value of the distinguished name? I tried to use ldaupwhoami, but it returns me 4 additional lines, that begin with SASL.

SASL/GSSAPI authentication started
SASL username: mzhurba@...
SASL SSF: 112
SASL data security layer installed.
dn:uid=mzhurba,ou=july,ou=2018,ou=people,dc=....,dc=ua 

How to get only the last line in format uid=...,ou=2018,ou=...,dc=...,dc=..

  • 2
    Provide the full output from the command that gives you your DN. Obfuscate if you need to do so, but keep it self-consistent – roaima Jul 10 '18 at 8:10
  • I need to get only this string: uid=mzhurba,ou=july,ou=2018,ou=people,dc=....,dc=ua – Николай Журба Jul 10 '18 at 8:41
0

Pipe the result through a sed command that matches on the leading dn: and prints everything else on (just) that line.

ldapwhoami | sed -n 's/^dn://p'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.