Legacy Forums > Experienced User Forum

Password change from shell prompt??

<< < (2/3) > >>

Terry Brummell:
There is a cgi script floating around that allows users to change passwords from the external interface.  I use it on my site and it works fine.

Terry

Nathan Fowler:
You could always update /etc/passwd to use /usr/bin/passwd as opposed to /bin/sshell.  By doing so when a user logs on the are able to change their password.  Just a thought.

Jason Judge:
Nathan,

I'm not quite sure what you mean, could you explain it any further? The user is able to issue a 'passwd' command without a problem and it does set a new password that is accepted by IMP and SSH.

It is just the Samba shares that don't seem to get their passwords changed: I can only connect to the Samba shares using the old password. Having said that, I don't entirely trust Win2000 SMB and cannot really say what username/password Win2000 is _really_ connecting as. Windows has its own way of doing things, and passwords are hidden behind the scenes once they have been entered and often refuse to be changed.

-- Jason

Nathan Fowler:
Ah, didn't know that was the hang-up.  Are you using the actual /usr/bin/passwd command and that isn't updating SAMBA?

Looking at my Samba.conf there is a directive telling that the SMB password file is /etc/smbpasswd and not /etc/passwd.  That being said, you may need to trigger an additional command other than /usr/bin/passwd, that command being /usr/bin/smbpasswd.

So, you could do the following to enable "Changing password" on SSH by:
Renaming /bin/sshell to /bin/sshell.old
Creating a new file called /bin/sshell with 755 access.

#!/bin/sh
#Password change script
/usr/bin/passwd
/usr/bin/smbpasswd

That would cover both SMB and the other services as well as providing the level of service you want.  A user would be unable to do anything past changing an SMB and System password.

Scott Smith:
Or just use the Mitel utilities to do this for you. Assuming you can write the script necessary to collect the username and password, then this is what you'd do in bash:

perl -e "
use esmith::util;
esmith::util::setUserPassword( '$username', '$password' );"

Or, if you prefer to require the previous password in order to change it:

perl -e "
use esmith::util;
esmith::util::setUserPasswordRequirePrevious( '$username', '$oldPassword', '$newPassword' );"

All $vars are shell vars.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version