How to log in as a user in p4

Solution 1:

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.