iFolder 3.8 Change Local User Password Script…

If you have an iFolder 3.8 (and some previous versions) server, and you use the local database (instead of LDAP or what-not), then you may have run into a situation where you have to change a password for a regular user when that current password is not known.

Of course, if the user *knows* his or her own password, he or she can use the “settings” link in the iFolder Web Access page, or the “Security” menu item in the client interface.

But if the password is UNknown, then you really have no choice but to do it on the command line of the iFolder server.  The problem with that, however, is that in order to do that on the command line, you’ll need to enter both the admin credentials and the user’s new credentials as well… which is never a good idea to do, since that will sit in the command history by default, etc.  Besides, who wants to memorize that crazy string anyway?

So, here’s a tiny little favor for you…  I stuffed it all into a tiny little helper script that you can have.  Just paste these contents into a script, do a chmod +x to make it executable, and away you go.  it will prompt you for admin password, username to change, and the new password for that user.

I hope it helps!  Here you go…

#!/bin/bash
clear
echo ""
echo "This is the user password change tool for iF3..."
echo ""
echo "Please enter the admin password: "
echo ""
read ADMINPW
clear
echo ""
echo "Please enter the username for which you are changing the password: "
echo ""
read USERNAME
clear
echo ""
echo "Please enter the new password for $USERNAME (careful with crazy special characters): "
echo ""
read USERPW
clear
echo ""
echo "Processing..."
echo ""
# For 32 bit...
/usr/bin/mono /usr/lib/simias/bin/UserCmd.exe setpwd --url http://localhost --admin-name admin --admin-password $ADMINPW --user $USERNAME --password $USERPW
# For 64 bit...
#/usr/bin/mono /usr/lib64/simias/bin/UserCmd.exe setpwd --url http://localhost --admin-name admin --admin-password $ADMINPW --user $USERNAME --password $USERPW
echo ""
# I know the exit codes from mono are of no real value, but oh well...
if [ "$?" -eq "0" ];then
echo "If the exit message reads: \"Failed - Invalid admin credentials\", the password for $USERNAME was not changed. "
echo "If the exit message reads: \"SetPassord for $USERNAME - False\", then $USERNAME might not exist in the system. "
echo "If the exit message reads: \"SetPassord for $USERNAME - True\", then the password for $USERNAME is now changed!"
else
echo "...The script encountered a problem! Exiting..."
exit 0
fi
echo ""
echo "...Done!"

🙂

11 Comments

  1. Ravi

    It works perfect for me. Thanks for the solution

  2. jars99

    Note that I had to change /usr/lib/simias…. to /usr/lib64/simias….

    Thanks for this – it’s not working for me, but I think it has to do with other issues on the system.

  3. Jeremy Pavlov

    @ Ravi – Thanks for that!

    @ jars99 – Ah, good point; I forgot to mention 64 bit (since I test in my 32 bit lab)… I’ll insert a note above… And I hope the rest works for you down the road…

    🙂

  4. Leon K

    Hello Jeremy,

    Thanks for the script.
    It looks nice and I’ll certainly use it.
    I can even think of some LDAP-iFolder tool to send a query to the LDAP and create local users in iFolder local DB if there is such a user in the LDAP. The only problem here as I see it, is password synchronization.

    I have a question about groups implementation in iFolder:
    How can I create groups?
    Is there an option to create groups on the command line and allocate users to those groups?
    I’ve managed to configure our LDAP to work with iFolder but I can’t see groups and users are not assigned to the groups 🙁

  5. Jeremy Pavlov

    @ Leon –

    Here is a good set of tips from the iFolder community site to see if you have LDAP set up correctly first.

    I hope it helps!

  6. tom

    Thank you very much. My password reset time has been cut in half.

  7. iulian paraschiv

    Hi there!
    I run the script but anything i do…i get Invalid Admin Credentials
    🙁
    please help

  8. Jeremy Pavlov

    @ iulian
    Is it possible that your admin password has a special character that is messing with the shell parsing of the script/command? Try simplifying your admin password temporarily to see if that helps.

  9. iulian paraschiv

    my password is something oh this type 1q2w3e
    i changed it to a simple word…but i still get invalid admin credentials

  10. aerobrain

    hi .. I have same issue ‘invalid admin credentials’

    fyi. I’m not using LDAP. ifolder 3.8 running on openSUSE 11.3.

    please help!

  11. KKnohl

    Thank You!!!

Leave a Comment

Your email address will not be published. Required fields are marked *