p4 login

Log in to the P4 Server by obtaining a ticket.

Syntax

p4 [g-opts] login [-s | -p] [-a | -h host] [user]
p4 [g-opts] login [-a -p] -r remotespec [--remote-user=X]
p4 [g-opts] login [-s] -r remotespec [--remote-user=X]

Syntax and naming conventions

Description

The p4 login command authenticates a user and creates a ticket that represents a session with the P4 Server. An authenticated user can access the P4 Server until the ticket expires or the user is logged out by the p4 logout command.

For users whose AuthMethod is idp, p4 login opens a web browser so the user can sign in through built-in single sign-on (SSO). If the client cannot open a browser, p4 login prints a URL to open instead. The command then waits up to the number of seconds set by the auth.idp.timeout configurable for the sign-in to finish. To learn more, see P4USEBROWSER, and the Log in section of the P4 Server Administration Documentation.

By default, tickets are valid for 12 hours. This value can be set for any group in the p4 group form.

Login attempts, whether successful or not, are logged to a structured log file. (See Structured logs in the P4 Server Administration Documentation.) If the attempt to log in fails, the reason is included in the log. In the case of authentication triggers or LDAP authentication (see p4 ldap), the parts of the error message that contain user data are sanitized as needed.

If you use LDAP authentication, you can set the getattrs option in the Options field of the LDAP specification to specify whether the Fullname and Email fields for users created by p4 login are populated from the directory.

See also Login process for the user in the P4 Server Administration Documentation.

Options

Option Description

-a

Obtain a ticket for the user that is valid on all the client workstations of this P4 Server. Logging in with -a means the ticket is valid for the user across multiple, connected servers, such as commit, replica, edge, and standby. (See also the -a option of p4 logout.)

-h host

Request a ticket that is valid for the specified host IP address. This option is typically used with the -p option to acquire a ticket that can be used on a different machine.

-p

Display the ticket, rather than storing it in the local ticket file.

-r

Specify the remote server to which the login is automatically forwarded. The login is for the user specified by the --remote-user flag. However, if the remote specification contains a RemoteUser entry, the login is performed for that user. (See p4 remote.)

-s

Display the status of the current ticket, if one exists.

Use with -a to display the status for all hosts, or with -h host to display the status for a specific host.

For users whose AuthMethod is idp, p4 login -s displays when the ticket from the built-in single sign-on (SSO) login expires.

Users with super access can provide a username argument to display the status of the ticket of that user. (See the Examples.)

user

(For the user with super access) Specify a username to log in as that user.

p4 login does not prompt the user with super for the password of the specified user.

A user with super access cannot log in as a user whose AuthMethod is idp.

Non-superusers who attempt to log in as other users must use the p4 -u username login form of the command and correctly supply the password of the other user.

g-opts

See Global options.

Usage notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

N/A

N/A

list

available to an operator user and a service user

Examples

p4 login

Prompt the user for a password. If the password is entered correctly, issue a ticket that is valid on the computer where the user runs the command.

p4 -u builder login -a

Attempt to log in as user builder. If the password is correct, issue a ticket that is valid on all the client machines of this Server.

p4 login -s maria

Get the status of the ticket of the specified user. The output might be:

User maria ticket expires in 430808 hours 17 minutes.
User maria on host 10.0.101.22: Ticket: Set

Related commands

To end a login session

p4 logout

To display tickets

p4 tickets