5

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?

the-wabbit
  • 40,319
  • 13
  • 105
  • 169
coffee
  • 239
  • 1
  • 4
  • 6
  • What security level is your server running (I'm assuming level 3) and are your clients Windows or Linux (or other)? – SmallClanger Aug 17 '11 at 12:52
  • Security level I'm not sure of... I was not the one to set up the server. The clients are Linux – coffee Aug 17 '11 at 13:04

1 Answers1

6

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.

SmallClanger
  • 8,947
  • 1
  • 31
  • 45
  • 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. – gareth_bowles Aug 29 '11 at 21:43
  • Checkout the user guide especially on the use of P4CONFIG: http://www.perforce.com/perforce/doc.current/manuals/p4guide/chapter.configuration.html#DB5-24024 – Lester Cheung Oct 24 '14 at 05:54