Perforce Public Knowledge Base - Deleting a User
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Reset Search



Deleting a User

« Go Back



Deleting a user in Perforce only requires the files opened by that user to be reverted first. Deleting the user this way is enough to reclaim the user from the server license, however it is preferable to delete other metadata relating to this user.

This article details the way to properly remove a user from the server, along with any pending changelists, files and clients that are owned by the user, as well as clean up the protect table and group memberships.



Using the P4Admin Tool

  1. As a Perforce user with 'super' privileges, start P4Admin or from P4V select the "Tools | Administration..." menu item. 

  2. Select the "Users & Groups" tab.

  3. Right click on the user that you would like to delete and select the "Delete user 'user_name'", where "user_name" is the name of the user account to be deleted. The "Delete User" dialog is displayed.

    This dialog will list the owned changes and workspaces that will also be deleted with the user account.

  4. There are two options in this dialog:

    • Delete shelved files in user's pending changelists: Removes any files shelved to any pending changelist (Default is unselected).

    • Remove all permissions assigned to this user from the Perforce data base: Any "user" based protections assigned to this user are removed from the protections table, and any group memberships are revoked (Default is selected).

  5. Click the "Delete" button to delete the user with the selected options.


Using the P4 command line client

  1. Determine the pending changes that are owned by this user and delete them:

    p4 changes -s shelved -u user_name

    Shelves can be deleted:
    p4 shelve -d -f -c change_number

    or you can choose to retain shelves by deleting the client workspace that contains the shelved files using the '-Fs' flag to 'p4 client -d -f' as detailed below.
    p4 changes -s pending -u user_name
    p4 change -d -f  change_number
  2. Determine the clients owned by this user and delete them:

    p4 clients -u user_name
    p4 client -d -f client_name

    If the client has shelved files, you can preserve the shelf content and delete the client using the '-Fs' option:
    p4 client -d -f -Fs client_name
  3. Delete the user from all groups that the user belongs to:

    p4 groups -u username

    Note: One way to speed this process is to use a command line utility such as grep to extract the name automatically. For example:

    p4 group -o group_name | grep -v user_name | p4 group -i

    If you do not have the spec depot turned on (See the Perforce System Adminstrator's Guide) save a copy of the group prior to making the change:

    p4 group -o group_name > group_name.old
  4. Remove any lines from the protections table that directly reference the user being deleted:

    p4 protect
  5. Delete the user:

    p4 user -d -f user_name

Note: Deleting a user does not affect file revision history.

Note: If you see this error message:

User username has file(s) open on 1 client(s) and can't be deleted.

It may be this user has some opened files associated with another user's client workspace or an unauthorised user took over an ownership of a client you are trying to delete. Run this command to see what files remained opened with this user:

p4 opened -u user_name

Follow the instructions in this Knowledge Base article on Reverting Another User's Files , then try deleting the user account again.

Related Links



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255