How to log in as a user in p4

9,189

Perforce uses two environment variables, P4PORT and P4USER (there are others, but these are the two you need). If P4PORT is undefined, it'll default to perforce:1666 and if P4USER is undefined, it'll default to the currently logged in username (on Linux it gets this form the USER variable). If that user doesn't exist in perforce, you'll see the message you described.

If you need clients to log in as a different username from their Linux one, they need to run:

export P4PORT=<server:port>
export P4USER=<perforce username>
p4 login

The error occurs if the server hasn't been set up to automatically create a user account on first access; and the username defned in P4USER (or the inferred one from USER) doesn't exist in the database.

Share:
9,189

Related videos on Youtube

coffee
Author by

coffee

Updated on September 18, 2022

Comments

  • coffee
    coffee over 1 year

    I have an issue where users are trying to log in to their perforce account using p4 (not p4v), but it seems to start at a default account without permissions. When they try to logout with p4 logout, they get "Access for user "foo" has not been enabled by 'p4 protect'".

    What is the standard way of logging out and logging in via p4?

    • SmallClanger
      SmallClanger over 12 years
      What security level is your server running (I'm assuming level 3) and are your clients Windows or Linux (or other)?
    • coffee
      coffee over 12 years
      Security level I'm not sure of... I was not the one to set up the server. The clients are Linux
  • gareth_bowles
    gareth_bowles over 12 years
    You'll get that error at any security level unless the server has been set up to automatically create a user account when a user accesses the server for the first time.
  • Lester Cheung
    Lester Cheung over 9 years
    Checkout the user guide especially on the use of P4CONFIG: perforce.com/perforce/doc.current/manuals/p4guide/…