5

I have installed jenkins on my ec2 instance using putty, from my windows system

When I try to access jenkins through web, I get the Unlock Jenkins using /var/lib/jenkins/secrets/initialAdminPassword enter image description here How to get to this location as if accessing through putty, I get permission denied to this folder.

Please advise, I am new to ubuntu and jenkins

3 Answers3

11

Try accessing the file using sudo:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
Litty Philip
  • 1,027
  • 10
  • 12
8

My solution is similar to the one by Mark B, I viewed the secrets by executing the cat command on the initialAdminPassword file.

However, I was not able to use cat to view the password until I gave my user permission.

Initially jenkins was the only user that had permissions to do anything with the secrets folder. I tried logging into the jenkins user account but could not. I executed:

sudo chmod a+rwx ./secrets

to give myself permission to view that directory.

As some background information, it might seem weird that I would give myself permission to "execute" a directory, but that is necessary in order to view its in the terminal using ls.

Also, my account is an admin account. I am running MacOS 10.11.4. Hope that helps.

sitting-duck
  • 961
  • 1
  • 10
  • 22
  • 1
    This worked for me as well. I had to do the same with the initialAdminPassword file (you can just set ``rw`` on that one obviously). – pandaman1234 Dec 08 '17 at 00:03
  • Thanks. This worked for me in a raspberry pi as well, where sudo cat /var/lib/jenkins/secrets/initialAdminPassword did not work initially. – Janaaaa Jun 15 '20 at 21:47
0

On the terminal, where you have connected to the Ubuntu EC2 instance, view the content of the file using the command sudo cat <path copied from the jenkins page>. It will show the default administrator password. You can copy and use this password in the GUI (browser) to log in first time.

divuu
  • 1