Perforce Public Knowledge Base - Deleting a User
Reset Search
 

 

Article

Deleting a User

« Go Back

Information

 
Problem

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.

Solution

 

Using the Perforce visual client (P4V/P4Admin, 2010.2 and later)

  1. In P4V, select the "Tools | Administration..." menu item. The P4Admin tool will open.

  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.

If Perforce hangs, perform use the command line client below.

Using the command line (P4) client (2010.2 and later)

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

    p4 changes -s shelved -u user_name
    p4 shelve -d -f -c change_number
    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 command to delete the client hangs, go to the Perforce root directory on the Perforce server (seen as "Server root:" in p4 info), find the client name under the client subdirectory of the server.locks directory, and delete this file.

  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

Feedback

 

Was this article helpful?


   

Feedback

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

Characters Remaining: 255