LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2005, 02:22 AM   #1
LouisR
LQ Newbie
 
Registered: Jan 2005
Location: Southern California
Distribution: FC3, RH9
Posts: 9

Rep: Reputation: 0
Linux passwords in /etc/shadow


Hello All,

Can someone please give me any insight on how the passwords in /etc/shadow are encrypted? I am attempting to develop a script that will update /etc/shadow with a new user password, but I don't know how the passwords are encrypted/hashed.

Also, is there a way to run /usr/bin/passwd so the password is updated automatically? (That way, I won't have to deal with /etc/shadow at all)

For example:

Code:
passwd username newpass
Instead of

Code:
passwd username
New UNIX password: <pw>
Retype new UNIX password: <pw>
Lastly, I looked at the stdin option: "--stdin read new tokens from stdin (root only)"

Is there a way to run passwd --stdin username and then send the new password to passwd through a script?

Thanks in advance.

Last edited by LouisR; 01-16-2005 at 02:23 AM.
 
Old 01-16-2005, 03:20 AM   #2
glalejos
LQ Newbie
 
Registered: Jan 2005
Distribution: Debian
Posts: 18

Rep: Reputation: 0
Hi,

I'm not used to deal with passwords, but it seems that they are encrypted using the crypt() function (see crypt(3) manual page), wich implements the DES algorithm.

I don't know what do you mean with:
Quote:
Also, is there a way to run /usr/bin/passwd so the password is updated automatically? (That way, I won't have to deal with /etc/shadow at all)
I haven't found the "--stdin" option in passwd.
 
Old 01-16-2005, 03:23 AM   #3
LouisR
LQ Newbie
 
Registered: Jan 2005
Location: Southern California
Distribution: FC3, RH9
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by glalejos
Hi,

I'm not used to deal with passwords, but it seems that they are encrypted using the crypt() function (see crypt(3) manual page), wich implements the DES algorithm.

I don't know what do you mean with:

I haven't found the "--stdin" option in passwd.
Thanks, I'll look into the crypt function.

What distro are you using? I'm running FC3. Check http://unixhelp.ed.ac.uk/CGI/man-cgi?passwd for more info... it includes the --stdin thing.
 
Old 01-16-2005, 10:41 AM   #4
glalejos
LQ Newbie
 
Registered: Jan 2005
Distribution: Debian
Posts: 18

Rep: Reputation: 0
I'm using Debian SID, and I'm almost sure that the man page of passwd of my distribution doesn't say a word about the --stdin option.
 
Old 01-16-2005, 12:45 PM   #5
LouisR
LQ Newbie
 
Registered: Jan 2005
Location: Southern California
Distribution: FC3, RH9
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by glalejos
I'm using Debian SID, and I'm almost sure that the man page of passwd of my distribution doesn't say a word about the --stdin option.
Maybe your version of passwd is different, because I know mine does. I'm running FC3.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php & shadow passwords rblampain Linux - Security 7 12-17-2004 10:55 PM
shadow passwords help? SciYro Linux - Security 2 03-03-2004 05:11 AM
shadow passwords dtheorem Linux From Scratch 2 10-18-2003 11:40 PM
shadow passwords and mdf njnear Linux - Security 5 08-06-2003 03:41 PM
Am I using shadow passwords? keirobyn Linux - Newbie 1 01-28-2002 12:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration