Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Oct 03, 2023 3:00 pm


Guides and tutorials for Red Hat Linux, Debian, Suse and others.

Author Message
debuser
  Post  Post subject: Linux change the password with output from echo command (standard input)  |  Posted: Thu Jan 14, 2010 5:58 pm

Joined: Thu Aug 06, 2009 2:48 am
Posts: 105

Offline
 

Linux change the password with output from echo command (standard input)

In Linux it is possible to change a user's password with the ouput of an echo command, coming from standard input, via pipe.
Code:
NAME
       passwd - update a user’s authentication tokens(s)

SYNOPSIS
       passwd  [-k]  [-l] [-u [-f]] [-d] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [user-
       name]

DESCRIPTION
       Passwd is used to update a user’s authentication token(s).

       Passwd is configured to work through the Linux-PAM API.  Essentially, it initializes itself as a "passwd" service
       with Linux-PAM and utilizes configured password modules to authenticate and then update a user’s password.

       A simple entry in the Linux-PAM configuration file for this service would be:

        #
        # passwd service entry that does strength checking of
        # a proposed password before updating it.
        #
        passwd password requisite \
                    /usr/lib/security/pam_cracklib.so retry=3
        passwd password required \
                    /usr/lib/security/pam_unix.so use_authtok
        #

       Note, other module-types are not required for this application to function correctly.

OPTIONS
       -k     The  option,  -k,  is  used  to  indicate that the update should only be for expired authentication tokens
              (passwords); the user wishes to keep their non-expired tokens as before.

       -l     This option is used to lock the specified account and it is available to root only. The  locking  is  per-
              formed  by rendering the encrypted password into an invalid string (by prefixing the encrypted string with
              an !).

       --stdin
              This option is used to indicate that passwd should read the new password from standard input, which can be
              a pipe.


Example of reading password from standard input:
Code:
# echo '123456789' | passwd --stdin tuser
Changing password for user tuser.
passwd: all authentication tokens updated successfully.

Above, user tuser's password was changed to '123456789'.





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "Linux change the password with output from echo command (standard input)"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Linux Shell: Protecting against accidental output redirection and file overwrite

LaR3

0

3092

Mon Aug 24, 2009 10:14 am

LaR3 View the latest post

There are no new unread posts for this topic. How to change crontab editor in Debian Linux

mandrei99

1

7116

Tue Mar 08, 2016 6:53 pm

tsuchan View the latest post

There are no new unread posts for this topic. Linux reloading inittab without reboot

debuser

0

5573

Thu Nov 26, 2009 4:49 am

debuser View the latest post

There are no new unread posts for this topic. Linux umount -f: umount2: Device or resource busy

debuser

0

4256

Fri Apr 09, 2010 7:52 am

debuser View the latest post

There are no new unread posts for this topic. Linux Shell: "Cannot overwrite existing file" when the file is owned by you

LaR3

0

6584

Mon Aug 24, 2009 10:26 am

LaR3 View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO