LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-16-2012, 05:52 PM   #1
px87
LQ Newbie
 
Registered: Nov 2011
Posts: 18

Rep: Reputation: Disabled
Problem with passwd and shadow files


Hi all!

Yesterday I was working with a perl module to change users password, but I don't know what happened, now the default file to store/read passwords is 'passwd' file instead 'shadow' file.

How can I set the 'shadow' file as the default file to store/read passwords?

Thanks!
 
Old 08-16-2012, 06:56 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
If you have the authconfig utility you can run:
Code:
authconfig --useshadow --update
I have to say that you shouldn't be running some perl module to set user passwords unless you know *exactly* what it does.
 
Old 08-16-2012, 07:46 PM   #3
px87
LQ Newbie
 
Registered: Nov 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbp View Post
If you have the authconfig utility you can run:
Code:
authconfig --useshadow --update
I have to say that you shouldn't be running some perl module to set user passwords unless you know *exactly* what it does.
Hi kbp, thanks for your answer.

I don't have authconfig, I'm on Debian.

The perl module was working fine, but I don't know what happened.

Thanks!
 
Old 08-16-2012, 07:50 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
The question we need to answer is "What happened?" .. can you give us the name of the module?
 
Old 08-16-2012, 07:56 PM   #5
px87
LQ Newbie
 
Registered: Nov 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbp View Post
The question we need to answer is "What happened?" .. can you give us the name of the module?
The module's name is 'Unix::PasswdFile' and I initialized it like this:

Code:
my $pw  = new Unix::PasswdFile "/etc/shadow";
then:

Code:
$pw->passwd( $username, $pw->encpass($pass_new) );
Thanks.
 
Old 08-16-2012, 08:03 PM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
I see no reference to shadow support in http://search.cpan.org/dist/Unix-Con.../PasswdFile.pm

Did you take a backup before you started playing?
 
Old 08-16-2012, 08:13 PM   #7
px87
LQ Newbie
 
Registered: Nov 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbp View Post
I see no reference to shadow support in http://search.cpan.org/dist/Unix-Con.../PasswdFile.pm

Did you take a backup before you started playing?
You're right... I'm working with wrong module... sh****!!

I read other module reference that supports shadow.

If I install authconfig with 'alien'. Could it works?

And no, I don't have backup.


Thanks.

Last edited by px87; 08-16-2012 at 08:15 PM.
 
Old 08-16-2012, 08:49 PM   #8
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
You don't need authconfig, you just need to fix the entries in your /etc/passwd file. *Theoretically* you may just need to fix the passord fields for any accounts you modified by replacing any content with an 'x', this tells shadow aware tools that the password is stored in /etc/shadow. Once complete perform a password change for any affected accounts.
 
Old 08-16-2012, 09:01 PM   #9
px87
LQ Newbie
 
Registered: Nov 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbp View Post
You don't need authconfig, you just need to fix the entries in your /etc/passwd file. *Theoretically* you may just need to fix the passord fields for any accounts you modified by replacing any content with an 'x', this tells shadow aware tools that the password is stored in /etc/shadow. Once complete perform a password change for any affected accounts.
kbp, thanks a lot for your help!
 
Old 08-16-2012, 10:13 PM   #10
px87
LQ Newbie
 
Registered: Nov 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
I solved my problem, I used the shadowconfig command with parameter 'on':

Code:
shadowconfig on
Thanks to kbp.

Last edited by px87; 08-16-2012 at 10:15 PM.
 
  


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
useradd command to create passwd, shadow & other files under different directory rramesh1 Linux - Newbie 2 05-20-2011 07:26 AM
Sync /etc/passwd and shadow files MikeyCarter Linux - Software 3 02-16-2008 02:22 AM
passwd shadow problem rblampain Linux - Distributions 2 10-04-2005 12:00 AM
Passwd and Shadow files synchronisation sandras Linux - Software 3 08-04-2004 10:09 AM
splitting up the passwd and shadow files Burgin Linux - General 1 07-26-2004 09:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:18 PM.

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