cancel
Showing results for 
Search instead for 
Did you mean: 
Create a Post

Forgot admin password in CLI

Support,

We reset the admin password, but somehow we forgot the password. Now we need to change the admin CLI passwork for Management Server. 

Please Help.

Chetan D. Lad

9 Replies
Admin
Admin

Re: Forgot admin password in CLI

In R77.x and earlier, you can do this with EmergenDisk: https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solut...

The SK has conflicting information about R80, but if you can still log into SmartConsole, it's possible to reset the admin password for the OS without EmergenDisk.
Here's the process:

  1. Generate the password hash you need using the following command on a Linux system: openssl passwd -1 mypassword (Note: if on a Check Point appliance, use cpopenssl instead)
  2. In SmartConsole, right-click on the management object and select Scripts > One-Time Script
  3. Type the following into the script field and click Run: clish -c 'set user admin password-hash mypasswordhash' (Note be sure to use single quotes here and replace mypasswordhash with the hash from step 1).

Screen Shot 2019-06-27 at 3.47.49 PM.png

 

Mike_A
Copper

Re: Forgot admin password in CLI

I have found success in the past using cprid_util (sk106490) to change the password when below R80.x. As Dameon mentions, the Script Repository is great for this now.

 

Below are the steps I had used in the past. 

 

1.) /sbin/grub-md5-crypt

a.) Enter Password 2x Times

b.) Copy Hash displayed on screen

 

2.) $CPDIR/bin/cprid_util -server 10.0.0.x -verbose rexec -rcmd /bin/clish -s -c 'show users'

 

3.) $CPDIR/bin/cprid_util -server 10.0.0.x -verbose rexec -rcmd /bin/clish -s -c 'set user <USERNAME> password-hash <HASHED PASSWORD FROM STEP #1>'

 

4.) $CPDIR/bin/cprid_util -server 10.0.0.x -verbose rexec -rcmd /bin/clish -s -c 'save config'

0 Kudos
Admin
Admin

Re: Forgot admin password in CLI

Note than in both cases, cprid is the underlying mechanism being used.
And yeah, I did forget the "save config" as part of this 😁
0 Kudos

Re: Forgot admin password in CLI

@Mike_A 

With the cprid_util it is only possible to reset the gateway GAIA password from the management server. I am use this script to execute remote commands.

More see here:

GAIA Easy execute CLI commands from management on gateways

How to remotely reset Admin / Expert password on a Security Gateway from a Security Management Serve...


To reset the management server password see this sk:

R77.30: Reset the Gaia Admin and Expert passwords using EmergenDisk USB flash drive

R80.10+ with a user with adminRule: How to reset the Expert mode password in Gaia OS

R80.10+ with SmartConsole  connection (steps from @PhoneBoy😞

1) Generate the password hash on a Check Point Appliance  in expert mode:
# cpopenssl passwd -1 mypassword
2) On SmartConsole under management object -> select scripts -> One-Time Script
3) Run the Script:
clish -c 'set user admin password-hash mypasswordhash


If anything doesn't help, open a TAC ticket.

 

 

 

Tags (1)

Re: Forgot admin password in CLI

Or a solution without Check Point support for VMWare and Hardware without RAID controller:

Attention, you can also destroy your system with this steps.

Should also work on an appliance or OpenServer without a RAID controller. I tried it with an appliance in the LAB.

So I used the best of aforementioned sites and successfully reset the admin password with this procedure on R80.10:

a) Configure the Check Point VM to use a recent Ubuntu/Debian Desktop ISO and boot from CD-ROM. Select Try Ubuntu so you will have a Live environment without installing Ubuntu.
b) Open the Terminal application.
c) Enter the following command: sudo su –
d) Create a mounting point: mkdir /mnt/cp
e) Mount the Gaia filesystem: mount /dev/mapper/vg_splat-lv_current /mnt/cp
f) Change the root directory to the Gaia root: chroot /mnt/cp
g) Backup the current Gaia configuration database: cp /config/db/initial_db /config/db/initial_db_backup
h) Connect to the Gaia configuration database: sqlite3 /config/db/initial_db
i) Query the database using SQLite to locate the current admin password. The last line is the current password hash:SELECT * from revisions WHERE binding=”passwd:admin:passwd”;
j) Update the database using SQLite to change the password to ‘admin’. Replace the text old-pw-hash below with the last hash from step i):UPDATE revisions SET value=”$1$zIVyrIdj$1LBW7Pg6XOcXYIgFPTppY.” WHERE binding=”passwd:admin:passwd” AND VALUE=’old-pw-hash‘;
k) Exit SQLite by entering the following command: .exit
l) Exit chroot and go back to Ubuntu/Debian: exit
m) Unmount the Gaia filesystem: umount /mnt/cp
n) Reboot the Check Point VM by entering: reboot
o) Login to the console, SSH or Gaia Portal using user admin and password admin.
p) When in CLISH or Gaia Portal don’t forget to change the password for user admin (and document it!)

 

 

 

Tags (1)

Re: Forgot admin password in CLI

Plan B with a migrate export:-)

1) Install a new managment server with the same IP.

2) Open a CLISH per ssh (do not close this session)

3) Open a second connection in expert mode and start a migrate import.

4) After the migrate import change to the CLISH session and change the admin password.

5) Now save the settings "save configuration"

 

That's all I can think of:-)

Tags (1)

Re: Forgot admin password in CLI

This way works fine😀.

0 Kudos
Highlighted
Mike_A
Copper

Re: Forgot admin password in CLI

@HeikoAnkenbrand 

Great point, I didn't fully read that the issue was resetting the admin password on the management server itself. 

0 Kudos
Danny
Pearl

Re: Forgot admin password in CLI