Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

passwd and usermod

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Tools Discussion Forum >> passwd and usermod Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
passwd and usermod - Nov. 20, '04, 4:35:52 PM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
Can you tell me the difference between the passwd command and usermod script? I've been trying to change password for one of the users on my system and thought I can as well do it via interix passwd. But when I type passwd username it asks me for password even though I'm the admin and when I type the old password for him and the new password then the error message appeares: password not changed. Bas address.
Post #: 1
RE: passwd and usermod - Nov. 20, '04, 10:57:31 PM   
markfunk

 

Posts: 673
Joined: Mar. 31, '03,
Status: offline
usermod does work differently than /bin/passwd and is sometimes more forgiving.
But you cannot use the scripts in /usr/examples/admin that are distributed
with SFU 3.0 and 3.5. These scripts were written for Interix 2.2 and do not work very well on 3.x.
You need to get the updated versions I wrote and are on the Microsoft web site. They are referenece via one of the Interix white papers. The one that talks about System Administration with Interix.

Try:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9e189a1b-6b9c-45f2-8a46-58393b12ce32&displaylang=en

(in reply to cortez_)
Post #: 2
RE: passwd and usermod - Nov. 21, '04, 2:54:50 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
And what about the error message that passwd produces?

(in reply to markfunk)
Post #: 3
RE: passwd and usermod - Nov. 21, '04, 10:47:26 PM   
markfunk

 

Posts: 673
Joined: Mar. 31, '03,
Status: offline
re: error message that says "Bad address".
You get this when a system call/library routine returns EFAULT.
This could mean that /bin/passwd or the chpass(2) system call has a bug.

Try "truss /bin/passwd ...." and see if chpass() is being called and

It might help if you could provide the cut/paste of the following:

$ /bin/id
$ /bin/pdomain
$ /bin/passwd .....

(in reply to cortez_)
Post #: 4
RE: passwd and usermod - Nov. 22, '04, 2:48:59 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
root ~#>id
uid=197611(root) gid=197121(Brak) groups=197121(Brak), 65792(+Wszyscy), 131616(+Administratorzy), 4095(CurrentSession), 66048(+LOKALNY), 66820(+INTERAKTYWNA), 66827(+Użytkownicy uwierzytelnieni)
root ~#>pdomain
CORTEZ


when I run truss passwd user I got the chpass executed and exited with an error:
chpass() chpass failed: errno 14, Bad address

(in reply to markfunk)
Post #: 5
RE: passwd and usermod - Nov. 23, '04, 8:58:42 AM   
markfunk

 

Posts: 673
Joined: Mar. 31, '03,
Status: offline
You didn't give us the /bin/passwd command line you used.

All evidence so far indicate it's a bug in chpass() or in /bin/passwd.

(in reply to cortez_)
Post #: 6
RE: passwd and usermod - Nov. 23, '04, 9:30:05 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
/bin/passwd megi

megi is the name of an user other than the root that has been executing the command

(in reply to markfunk)
Post #: 7
RE: passwd and usermod - Nov. 23, '04, 10:00:57 AM   
markfunk

 

Posts: 673
Joined: Mar. 31, '03,
Status: offline
thanks. So megi is really "cortez+megi", right ?
Just making sure this was a straight forward request.

(in reply to cortez_)
Post #: 8
RE: passwd and usermod - Nov. 23, '04, 10:40:02 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
megi is a local user and if I'm correct in my nightmare assumptions it might in fact be the CORTEZ+megi where CORTEZ is the name of the computer in win32 world.

(in reply to markfunk)
Post #: 9
RE: passwd and usermod - Feb. 8, '05, 7:25:21 PM   
prj32

 

Posts: 29
Joined: Oct. 16, '04,
Status: offline
Any resolution with the bad address problem when using passwd? I get the same problem on SFU 3.5.

(in reply to cortez_)
Post #: 10
RE: passwd and usermod - Feb. 8, '05, 10:47:21 PM   
markfunk

 

Posts: 673
Joined: Mar. 31, '03,
Status: offline
The message "bad address" is caused by an EFAULT in the code.
This usually means there was a bug in the user application
(in this case, /bin/passwd).

It looks like the program /bin/passwd is not passing a
fully qualified name to the chpass() system call.
This is one case in which I can repro the behaviour.
(the other case is if the account is "disabled")

So, the workaround is to use a fully qualified user name
(ie /bin/passwd cortez+megi )

(in reply to prj32)
Post #: 11
RE: passwd and usermod - Feb. 9, '05, 12:20:33 AM   
prj32

 

Posts: 29
Joined: Oct. 16, '04,
Status: offline
You guys working on a fix? because even the fq /bin/passwd doesn't work for me.

< Message edited by prj32 -- Feb. 9, '05, 12:27:18 AM >

(in reply to markfunk)
Post #: 12
RE: passwd and usermod - Feb. 9, '05, 3:11:33 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
I gave up, in case I have the sources of the interix passwd I could do some digging, but I doubt if the bsd or gnu sources will do...

(in reply to prj32)
Post #: 13
RE: passwd and usermod - Feb. 9, '05, 12:30:18 PM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
There is not much code to passwd.
The key API call is chpass() for which there is a man page.
Around the call to chpass() is the code that asks for a new password
(repeat to make sure) and then some (optional) code to check for a "good"
password. It's pretty easy to do.

(in reply to cortez_)
Post #: 14
RE: passwd and usermod - Feb. 10, '05, 3:24:43 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
Where can I find the source of passwd to look deeper inside? Would the gnu passwd be OK (I doubt)? Or somewhere else?

(in reply to Rodney)
Post #: 15
RE: passwd and usermod - Feb. 10, '05, 11:35:18 AM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
The password for Interix was written from scratch as I recall.
You can write, compile and link it in about 20 minutes for a first draft.
In pseudo-code it goes like this:
p = getpass();
p1 = strdup(p);
p = getpass(); /* double check the entry */
if (p1 != p)
    error
else 
    ret = chpass(user, p)
    if (ret == error)
        write error
    else
        write success


You can get the user name with a getpwuid(getuid()).
You can add good password cheecking if you want.
The above is the core of it.

(in reply to cortez_)
Post #: 16
RE: passwd and usermod - Feb. 10, '05, 10:54:33 PM   
markfunk

 

Posts: 673
Joined: Mar. 31, '03,
Status: offline
1) chpass() takes 3 args: fqusername, oldpasswd, newpasswd
2) use getpwuid_ex() so that you get back the fully qualifed username.
This is the problem that is currently in /bin/passwd.
3) If you're getting the EFAULT problem with a fully qualified
username using /bin/passwd, then it is possible the bug is in chpass().
You can test this by using my program:
quote:

#include <errno.h>

main(int argc, char **argv)
{
char *user = argv[1];
char *oldpass = argv[2];
char *newpass = argv[3];
int x;

printf("user = '%s', oldpass = '%s', newpass = '%s'\n",
user, oldpass, newpass);
x = chpass(user, oldpass, newpass);
if (x == 0) {
printf("success\n");
} else {
printf("error: (%d) %s\n", errno, strerror(errno));
}

}

Usage: ./chpass domain+username oldpass newpass

(in reply to Rodney)
Post #: 17
RE: passwd and usermod - Feb. 11, '05, 2:16:34 AM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
I'm just posting up a /Tools version of passwd.
This is a from scratch version. I mention this since I wrote passwd
back in the Softway (pre-MS) days (yeah, that's my user account on the man page).
This version does use getpwuid_ex(). (Though this API didn't exist when passwd was originally written).

Install it and see how it goes for you. Let us know.

pkg_add ftp://ftp.interopsystems.com/pkgs/3.5/passwd-current-bin.tgz

(in reply to markfunk)
Post #: 18
RE: passwd and usermod - Feb. 14, '05, 3:06:43 AM   
cortez_

 

Posts: 330
Joined: Mar. 27, '04,
From: Poland
Status: offline
Now it seems to be working fine (identifies user).
Thanks a lot ;)
Now only the ssh issue keeps me upset :(

(in reply to Rodney)
Post #: 19
RE: passwd and usermod - Feb. 14, '05, 6:08:23 PM   
prj32

 

Posts: 29
Joined: Oct. 16, '04,
Status: offline
works a treat!

(in reply to cortez_)
Post #: 20
Page:   [1] 2   next >   >>
All Forums >> [SFU / Interix / SUA Technology] >> Tools Discussion Forum >> passwd and usermod Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.063