Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-05

How to change a users password on Linux

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

A.J. Venter

Hi,

I am working on a project that needs among other things to create Linux users, and then set a password for them.

One way to do this is to use a program that can read the password from stdin and just wrap around it, for example
echo "testusers:test" | chpasswd will change testuser's password to test on Slackware.
Likewize redhat likes have a version of passwd that takes a --stdin option, so you can do
echo "test" | passwd --stdin testuser
Both these can only be run by root of course.

The problem is no system seems to support both, and I need maximum distribution indepedance. Has anybody else done a frontend for user management or similiar system ? Can anyone tell me how to set a user's password in a distribution independant way ?

TIA
A.J.

Reply by email

Unknown author
to A.J. Venter: I am working on a project that needs among other things to create Linux users, and then…
A.J. Venter wrote 18 lines
Hi, I am working on a project that needs among other things to create Linux users, and then set a password for them. One way to do this is to use a program that can read the password from stdin and just wrap around it, for example echo "testusers:test" | chpasswd will change testuser's password to test on Slackware. Likewize redhat likes have a version of passwd that takes a --stdin option, so you can do echo "test" | passwd --stdin testuser Both these can only be run by root of course. The problem is no system seems to support both, and I need maximum distribution indepedance. Has anybody else done a frontend for user management or similiar system ? Can anyone tell me how to set a user's password in a distribution independant way ?

libc unit. putpwent() and friends.
in the FPC sources, see packages/base/libc/pwdh.inc for all functions.

Michael.

Reply by email