Reset ALL user password

Hello, I'm looking for a way to reset ALL user passswords at once, without manually selecting them one by one in the admin console. Selecting more than one user disables the reset password function, so I'm looking for an alternative.

Now take a look at the /tmp/changepw.cmd file and see if it contains a list of change password commands for all your users in Zimbra. If so, good. We can use that list to reset everyone's accounts. But you might want to go through that file and remove anyone you do not want the password reset...such as admin and the service accounts for spam and whatnot.

Once you are satisfied with the list, simply run the following at the command prompt as the Zimbra user:

Code:

zmprov < /tmp/changepw.cmd

If you plan to run this periodically via a schedule, you can add the following command at the end of the above script:

Code:

su - zimbra -c "zmprov < ${CMDFILE}"

But if you do automate it, you need to be sure to also automate the removal of any IDs you manually removed from the list during this process. It would also be a good idea to add rm ${CMDFILE} to the very end as well to cleanup what was created.

If you are getting a permission denied error, then you are not running it as a user with sufficient permissions to the /tmp folder.

Either change the tmp path to someplace you can write to or run it with the root-level access. You might have to use root-level access anyway to access the zmprov utility. I'm still too new to all this to know all the possibilities.

Example:

Code:

sudo ./list.sh

All the scripts I've been writing have been with the root user in mind since I plan on them running on a schedule.

The /tmp folder should already be there with the correct permissions. This is a special folder that is purged each time the server reboots and is a good location for temporary files.

The /tmp folder should look like this:

Code:

drwxrwxrwt 4 root root 4096 2011-10-20 10:12 tmp

The permissions on the folder you created (/temp) should be sufficient for the root user to do anything. But any other user will not be able to create or modify files in that folder. If you fix the script permissions (below) and you still see deny permission to /temp, they you are not running the script as root user.

The problem with your script is that it has the incorrect permissions. It should look like this:

Code:

-rwxr-xr-x 1 root root 600 2011-10-19 13:57 list.sh

You are missing the "x" which is the "execute" permission.

To fix the permissions, type this:

Code:

chmod 0755 list.sh

The above command will allow anyone to execute that script as long as they have access to the location where it is stored. However, if you only want root to have access, simply change the permissions like this:

Code:

chmod 0700 list.sh

File permissions are necessary for understanding and administering a Linux server. Here is some further reading I recommend: File Permissions