I want to retrieve the username and password of the current user from a shell script ....
how to do this?

#!/bin/sh

echo ${USER}

Password is a whole different (uglier) beast.

any links to help getting password......

*Points to his previous post*

Ok, something to keep in mind, the password is ENCRYPTED, so even if I told you where to find it (/etc/passwd, /etc/shadow) it will do you no good unless you can figure out how to DECRYPT it... *nix is pretty secure... they don't just let you have your way with passwords.... hacker.

LOLZ
if i was a hacker then probably i would have been able to do this and not writing in forums asking for help...............

Why do you need the password?

The easiest way to get the password is to ask the user for it, and explain why you need it.

passwords are usually stored as hashes (a one-way function).
http://en.wikipedia.org/wiki/Cryptographic_hash_function
There is no simple function to go in the other direction.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.