Jump to content

Error when passing password via command line as well as exporting P4PASSWD

password login commandline

  • Please log in to reply
3 replies to this topic

#1 rohitasave



  • Members
  • Pip
  • 2 posts

Posted 28 October 2014 - 01:29 PM

I am trying to access my depot without entering password in the prompt. My password will be hardcoded somewhere in my automation script that will checkout the code for me from depot.

I am using a linux box and command line client utility.
Below are the things I have tried:

export P4PORT=ssl:perforce:1666
export P4CLIENT=sample_machine
export P4USER=user
export P4PASSWD=password

After I have done all this, when I run `p4 login` on terminal, I see following the prompt for 'Enter password:'

When I pass `p4 -Ppassword sync //depot/...`, I see this: 'Perforce password (P4PASSWD) invalid or unset.'

Can anyone please help me out with the problem which I am facing? I want to sync my depot everytime when I run my script and password prompt should not be displayed. It should be taken from command line itself. Have I missed anything?

#2 P4Matt


    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 30 October 2014 - 08:29 PM

I suspect that your server has security level 3 enabled which only allows access via 'p4 login'. Run:

p4 -ztag info

from the command line. If you see '... security enabled' then it is set.

In your script you can run:

echo MYPASSWORD | p4 login

to log yourself in. Then you should be able to run the sync.

#3 P4Shimada


    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 30 October 2014 - 09:21 PM

As reference, see the following articles:



#4 rohitasave



  • Members
  • Pip
  • 2 posts

Posted 31 October 2014 - 03:39 AM

Thanks Matt and Shimada.

@Matt: When I ran: p4 -ztag info
I saw security as enabled. But the solution which you gave worked well.

@Shimada: The links which you posted helped me a lot.

Also tagged with one or more of these keywords: password, login, commandline

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users