Hi, i got this script.. to let one user (not root), to "su" another user and change his password. but it doesn't work well. it asks to enter the new password, then, re-enter de new password, then it asks again to change the password... (he asks twice) and , it only has to ask once
Any ideas???
# Get USER
while [[ -z ${user} ]];
do
read user?"Enter User: "
done
su - $user -c passwd
For me, Solaris won't even allow passwd from su, and from CentOS it works fine:
Solaris:
Enter User: test1
Password:
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
passwd: Changing password for scott
Permission denied
CentOS:
Enter User: test1
Password:
Changing password for user test1.
Changing password for test1
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
You have to enter the old password at least twice. Once for the su, and the other for the passwd command.
Perhaps your OS is just doing it in a different order.