skip to Main Content

For some reason I have to install a perforce server and I’ve been trying to automate the installation but I have a stupid issue with the fact that I can’t rerun the script a day after as the session expired.

For clarification pupose:

  • I’m installing perforce server on linux, the server is running a debian and I’m following the linux installation (that works) and installing the helix-p4d package.
  • Following that I’m configuring the server using the /opt/perforce/sbin/configure-helix-p4d.sh script and passing the parameters as option to the script.
  • I then follow the security recommandation of perforce for the installation: https://www.perforce.com/manuals/p4sag/Content/P4SAG/chapter.security.html

All the command below are executed on the perforce server.

I’ve done some reading and some suggest to create a ticket with no expiration using this command:

p4 login -a -p

I tried and got the tickets string to use for connection:

p4 -P STRING login

And I got asked the password… I don’t really understand what I’m doing wrong there and I don’t know how to check the ticket expiration date.

I tried other simpler things like:

  • setting the P4PASSWD variable using p4 set P4PASSWD=PASSWORD , that doesn’t seem to be working anymore, the value is not visible when doing a p4 set -s
  • setting the P4PASSWD variable directly in $HOME/p4enviro file… the value appears in p4 set -s but p4 login still asks for the password.

I would really like to have the ticket thing working with no time of expiration but at this point I will take anything that prevents the password from being asked…

Does anyone knows how to set the password or tickets for it to work?

EDIT:

I also tried to change the security parameter of the perforce configuration to not require the ticket auth as in parameters 3/4 (default value) and tried the values for compatibility but I still can’t set the P4PASSWD.

2

Answers


  1. If your server doesn’t have a security level that requires login tickets to be used, and you want to use direct password authentication for every command instead of ticket-based authentication, you can completely disregard p4 login. The only purpose of p4 login is to give you a ticket for ticket-based authentication. To delete any existing login ticket you might have, do:

    p4 logout
    

    Then to set the plaintext password in your environment for authentication, do:

    p4 set P4PASSWD=your_password
    

    Test that it worked by running a command that requires authentication, e.g.:

    p4 changes -m1
    

    Do not run p4 login if you do not want to authenticate with tickets. p4 login completely disregards your P4PASSWD value (the idea is that if you’re using tickets for security you should not be setting your password in your environment, so everything related to ticket-based authentication ignores/discourages the use of P4PASSWD) and will always prompt you for your password.

    Note that p4 set and p4 set -s apply to different environment namespaces; if you set a variable with p4 set, then check it with p4 set:

    p4 set P4PASSWD
    

    will show you the P4PASSWD value for the current user. The -s flag sets and queries the environment for the System user on Windows.

    If the server requires ticket-based authentication (e.g. the security counter is set to 3, which is the standard for admins who want a modicum of security on their Perforce installation), you will need to request the ability to create unlimited-timeout tickets. This is done by assigning you to a group with Timeout: unlimited.

    Login or Signup to reply.
  2. It sounds like your user is not set to have an unlimited ticket yet.

    The p4 login -a -p command will give you a ticket for this user that can be used on any machine, but it does not make that ticket unlimited. In order to change a user’s ticket timeout, you need to create a group with an unlimited login timeout and then add the user to that group.

    If you want to do it in the CLI, this page covers how to do that https://portal.perforce.com/s/article/2589
    But you can also do it in P4Admin from any machine.

    Login to P4Admin as a Super user. At the top menu, click on the Add Group button.

    enter image description here

    Then in the Group Dialog, give it a name (like Unlimited), click Browse… to select your user and add it to the group, then select the Unlimited radio button for Duration before login session times out.

    enter image description here

    After you click OK and create that group, then try once you login, the session on that machine should stay valid forever (until you manually logout or change the password).

    Hope that helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search