LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Problem with passwd and shadow files (https://www.linuxquestions.org/questions/linux-security-4/problem-with-passwd-and-shadow-files-4175422508/)

px87 08-16-2012 05:52 PM

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!

kbp 08-16-2012 06:56 PM

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.

px87 08-16-2012 07:46 PM

Quote:

Originally Posted by kbp (Post 4756142)
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!

kbp 08-16-2012 07:50 PM

The question we need to answer is "What happened?" .. can you give us the name of the module?

px87 08-16-2012 07:56 PM

Quote:

Originally Posted by kbp (Post 4756175)
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.

kbp 08-16-2012 08:03 PM

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?

px87 08-16-2012 08:13 PM

Quote:

Originally Posted by kbp (Post 4756184)
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.

kbp 08-16-2012 08:49 PM

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.

px87 08-16-2012 09:01 PM

Quote:

Originally Posted by kbp (Post 4756211)
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!

px87 08-16-2012 10:13 PM

I solved my problem, I used the shadowconfig command with parameter 'on':

Code:

shadowconfig on
Thanks to kbp.


All times are GMT -5. The time now is 11:51 PM.