LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 06-22-2008, 04:34 PM   #1
Neavirc
LQ Newbie
 
Registered: Apr 2008
Posts: 12

Rep: Reputation: 0
A few questions about passwd


I was reading the man page for passwd utility and there were some not clear points for me.

Firstly, how can I see the result of the following option?

Quote:
-k, --keep-tokens
Indicate password change should be performed only for expired authentication tokens (passwords). The user wishes to keep their non-expired tokens as before.
I thought that the command "passwd -k" won't have effect if my password isn't expired, but this is wrong! I can change any password with "passwd -k"!

Let's create a test user (I will type the following commands as root):

> useradd -m foo

then let's set a password for it:

> passwd foo
Enter new UNIX password: bar
Retype new UNIX password: bar
passwd: password updated successfully

To make sure that the password isn't outdated type this:

> passwd -S foo
foo P 06/23/2008 0 99999 7 -1

99999 is enough large number of days.

But the password will be changed anyway if I'll run "passwd -k" under foo (or "passwd -k foo" under root). Why? What does actually mean the -k option? How can I use it?

Secondly, there is an option to limit the period between password changes - "--mindays":

Quote:
-m, --mindays MIN_DAYS
Set the minimum number of days between password changes to MIN_DAYS. A value of zero for this field indicates that the user may change his/her password at any time.
But this doesn't work!

Let's create a test user:

> useradd -m bar

with some password:

> passwd bar
Enter new UNIX password: 123
Retype new UNIX password: 123
passwd: password updated successfully

Default value of MIN_DAYS is 0, which means that user can change his/her password at any time:

> passwd -S bar
bar P 06/23/2008 0 99999 7 -1

Set the MIN_DAYS to 3 days by the following commands:

> passwd --mindays 3 bar
Password changed.
> passwd -S bar
bar P 06/23/2008 3 99999 7 -1

That is the user bar can change his password only once every three days. But this isn't true! Under bar I can change the password indefinite number of times as before!

Thanks!
 
Old 06-22-2008, 05:34 PM   #2
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
Did you login as the particular user before attempting the changes?

root can override anything.


Best

A. Mani
 
Old 06-22-2008, 05:51 PM   #3
Neavirc
LQ Newbie
 
Registered: Apr 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by amani View Post
Did you login as the particular user before attempting the changes?
Yes, I did. I tried that out as both foo/bar and root.

For example here is three passwd calls related to the second question (--mindays):

Code:

Quote:
[bar@aldan-3 sergey]$ passwd -S bar
bar P 06/23/2008 3 99999 7 -1
[bar@aldan-3 sergey]$ passwd
Changing password for bar.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
[bar@aldan-3 sergey]$ passwd
Changing password for bar.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
[bar@aldan-3 sergey]$ passwd
Changing password for bar.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
 
Old 06-23-2008, 10:47 AM   #4
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
All these are distro-specific and there are many possibilities. For example, If you enable NIS, then users will not be able to change passwords at all.
 
Old 06-23-2008, 12:09 PM   #5
Neavirc
LQ Newbie
 
Registered: Apr 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by amani View Post
All these are distro-specific and there are many possibilities. For example, If you enable NIS, then users will not be able to change passwords at all.
Thanks for your answer.

So it isn't a bug? I was going to post a bug report at bugtracker of my distro this evening =)
 
  


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
Passwd sakthi.s Linux - Server 3 11-06-2007 12:42 AM
/etc/passwd magin Linux - Newbie 5 04-03-2007 04:45 PM
Swat uses PAM but changes linux passwd not samba passwd Peter@KKVS Linux - Networking 0 11-26-2006 05:20 AM
what is /etc/passwd- for? xpucto Linux - Security 7 11-22-2006 05:47 PM
Questions about "passwd" swmok Linux - Software 1 09-05-2003 12:28 PM

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

All times are GMT -5. The time now is 12:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration