Avoiding the Perforce Prompt for Password in Windows
PROBLEM
At security level 2 you can no longer use P4PASSWD to store your Perforce password under Windows.
SOLUTION
Ticket-based authentication works at all security levels, and is the default authentication method used by all Perforce GUIs. By default, your login ticket expires 12 hours after it is issued; a Perforce administrator can configure the expiration period by changing the Timeout value for your group. See "Authentication Methods, Passwords, and Tickets" in chapter 3 of the Perforce System Administrator's Guide for more information on login tickets.
If you prefer to use P4PASSWD-based authentication, you must set P4PASSWD as a system environment variable, rather than setting it in the registry with p4 set. The procedure below uses the Windows set command to set the P4PASSWD environmental variable. This bypasses ticketing even under security level 2. The password is not set in cleartext.
- Completely log out of Perforce using p4 logout -a. You might have to log in to perform this step:
p4 login Enter password: User perforce logged in.
p4 logout -a User perforce logged out.
-
Ensure P4PASSWD is not set by running p4 set.
If P4PASSWD appears in the list of variable settings, unset it with the command:
p4 set [-s] P4PASSWD=
- Obtain the MD5 hash of the password.
This is not ticket related, so do not use p4 login -p. To obtain an MD5 hash, use a utility that generates MD5 hash values or use a web based conversion tool.
For example, the MD5 hash for "hellother3" is "bb4505b8bc6051af4a6feb31a2ece1e7".
-
Convert the MD5 hash to upper case (the lowercase MD5 hash will not work). Many text utilities have features that convert text to upper case.
An easy way to do steps 3 and 4 is to run (in either Windows or Unix):
$ perl -MDigest::MD5=md5_hex -e"print uc(md5_hex(@ARGV[0]))" hellother3 BB4505B8BC6051AF4A6FEB31A2ECE1E7
See http://maillist.perforce.com/pipermail/perforce-user/2008-January/023142.html for more information.
Alternatively, you can run the md5sum utility (if it is available on your computer) and capitalize its output to obtain the password. You must use the -n flag on the echo command, as shown in this example:
$ echo -n "hellother3" | md5sum | tr a-z A-Z BB4505B8BC6051AF4A6FEB31A2ECE1E7
- Use the Windows set command (not p4 set) to set the P4PASSWD environmental variable to the MD5 hash:
set P4PASSWD=BB4505B8BC6051AF4A6FEB31A2ECE1E7
- To verify that it is working, use p4 login -s:
p4 login -s User perforce was authenticated by password not ticket.
Visual Studio Users
Since the Windows set command is seen from the command prompt, Visual Studio must be started from the command prompt by providing the full path to the IDE's executable:"F:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"You are no longer prompted for a password in Visual Studio when using the P4SCC plug-in .
