Hi i need do a small interfaz, it works under bash.
I read the user name and password from the terminal then i need validate this data.
my principal dude is:
how look in the /etc/passwd file a user and passwd?
the problem is the password is encrypted and i need compare with the data i read.
Note:
Only i can use BASH because it is school homework.
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
how validate users using passwd file?
Re: how validate users using passwd file?
If it's homework, then I'm pretty sure that your instructor wants you to figure out the answer on your own. That's kind of the whole point of homework.linux_saul_mex wrote:Only i can use BASH because it is school homework.
-
- Posts: 2
- Joined: 2014-08-25 01:53
Re: how validate users using passwd file?
Yes you are right but this is a one way by do the homework.(search and question on forums).dasein wrote: If it's homework, then I'm pretty sure that your instructor wants you to figure out the answer on your own. That's kind of the whole point of homework.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: how validate users using passwd file?
Search, yes. Validate an idea, yes. Ask someone to answer the question for you, no. (Google dyodh for details.)linux_saul_mex wrote:Yes you are right but this is a one way by do the homework.(search and question on forums).dasein wrote: If it's homework, then I'm pretty sure that your instructor wants you to figure out the answer on your own. That's kind of the whole point of homework.
Re: how validate users using passwd file?
Password information is not present in /etc/passwd. It is stored in encrypted form in /etc/shadow. /etc/shadow will not help you with your script because it is readable only by root; regular users running your script will not be able access the shadow passwords.linux_saul_mex wrote:Hi i need do a small interfaz, it works under bash.
I read the user name and password from the terminal then i need validate this data.
my principal dude is:
how look in the /etc/passwd file a user and passwd?
Since this is a homework assignment, I will not provide a direct answer (also, you've not provided enough information for me to do so effectively), however, I will point out that one way to do this would be to use expect to execute 'su' and automatically provide the password in response to the prompt.
You might also be able to invoke PAM somewhat directly. I don't use PAM so I can't say for sure that this will work from BASH (though it is often done in other languages).
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan