Python Pexpect and Check Point Gaia Expert Mode - Check Point CheckMates

Python Pexpect and Check Point Gaia Expert Mode

I administer a few Check Point Firewalls at work that run on the Gaia operating system. Gaia is a hardened, purpose-built Linux OS using the 2.6 kernel.

I am a novice at Python and I need to write a script that will enter "expert mode" from the clish shell. Entering expert mode is similar to invoking su as it gives you root privileges in the BASH shell. Clish is a Cisco like custom shell made to ease OS configuration changes.

I saw a similar discussion at pexpect and ssh: how to format a string of commands after su - root -c, but people responding recommended sudo. This is not an option for me as sudo is not supported by the OS and if you were to install it, clish would not recognize the command.

The goal of my script would be to SSH to the device, login, invoke expert mode, then run grep admin /etc/passwd and date. Again, sudo is not an option.

0

Kudos

Click here to give kudos to this post.

1

2

3

4

5

0.5

1.0

1.5

2.0

2.5

3.0

3.5

4.0

4.5

5.0

Reply

3 Replies

Nick_Doropoulos

Advisor

‎2019-05-0112:45 PM

Show option menu

Hi Lisa,

Thank you for raising this query.

Personally, I don't think there is a need for a script here as it's way easier by carrying out the instructions below:

  1. Navigate to the firewall's expert mode and type chsh -s /bin/bash admin

The above command should put you in expert mode upon the next login.

  1. Then, to display the output of certain commands upon login, you will need to edit the .bashrc file inside the /home/admin directory. Once inside the said directory:

vi .bashrc

Press Shift + G to go to the bottom of the file followed by ' o' to start editing the file.

Next type the commands that you want.

grep admin /etc/passwd

date

Have a look at this screenshot as well if needed:

  1. Finally, press Escape followed by :wq to save the changes. The end result can be seen below next time you login:

  2. Repeat the same process on every other firewall.

Since you said that you administer only a few firewalls I believe that would suffice.

I hope this helps.

0

Kudos

Click here to give kudos to this post.

1

2

3

4

5

0.5

1.0

1.5

2.0

2.5

3.0

3.5

4.0

4.5

5.0

Reply

Lisa11

Explorer

‎2019-05-0212:46 AM

Show option menu

In response to Nick_Doropoulos


@Nick_Doropoulos wrote:

Hi Lisa,

Thank you for raising this query.

Personally, I don't think there is a need for a script here as it's way easier by carrying out the instructions below:

  1. Navigate to the firewall's expert mode and type chsh -s /bin/bash admin

The above command should put you in expert mode upon the next login.

  1. Then, to display the output of certain commands upon login, you will need to edit the .bashrc file inside the /home/admin directory. Once inside the said directory:

vi .bashrc

Press Shift + G to go to the bottom of the file followed by ' o' to start editing the file.

Next type the commands that you want.

grep admin /etc/passwd diebestetest

date

Have a look at this screenshot as well if needed:

  1. Finally, press Escape followed by :wq to save the changes. The end result can be seen below next time you login:

  2. Repeat the same process on every other firewall.

Since you said that you administer only a few firewalls I believe that would suffice.

I hope this helps.


Happy to help! Thanks for leaving a comment.

0

Kudos

Click here to give kudos to this post.

1

2

3

4

5

0.5

1.0

1.5

2.0

2.5

3.0

3.5

4.0

4.5

5.0

Reply

PhoneBoy

Admin

‎2019-05-0109:14 PM

Show option menu

Note that we do not support the use of expect.

If it is absolutely required please work with your local office to put in an RFE.

0

Kudos

Click here to give kudos to this post.

1

2

3

4

5

0.5

1.0

1.5

2.0

2.5

3.0

3.5

4.0

4.5

5.0

Reply

Post Reply

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

User Count

israelfds95
13

HeikoAnkenbrand
7

simonemantovani
5

emmap
3

Steffen_Appel
2

Kaspars_Zibarts
1

Alex-
1

Danny
1

Bob_Zimmerman
1

DH
1

View All ≫

Trending Discussions

Five Habits That Improved My Check Point Deployments

Automatically Renew VPN Certificates

Snapshot and /boot disk space full

Upcoming Events

Sort by:

Virtual

Tue 28 Jul 2026 @ 11:00 AM (EDT)

Under the Hood - Check Point and Illumio – Modern Network Defense Against AI-Based Threats

Virtual

Wed 29 Jul 2026 @ 12:00 PM (SGT)

The AI Security Report 2026: A Turning Point for Enterprise Defense - SGT

Virtual

Wed 29 Jul 2026 @ 02:00 PM (IDT)

The AI Security Report 2026: A Turning Point for Enterprise Defense - AMER

Virtual

Wed 29 Jul 2026 @ 03:00 PM (CEST)

The AI Security Report 2026: A Turning Point for Enterprise Defense EMEA

Virtual

Wed 29 Jul 2026 @ 11:00 AM (EDT)

TechTalk: On-Premise SD-WAN Management

Thu 30 Jul 2026 @ 11:30 AM (CDT)

CheckMates Live DFW: Agentic AI Security Deep Dive & Hands-On

Virtual

Tue 28 Jul 2026 @ 11:00 AM (EDT)

Virtual

Wed 29 Jul 2026 @ 12:00 PM (SGT)

Virtual

Wed 29 Jul 2026 @ 02:00 PM (IDT)

Virtual

Wed 29 Jul 2026 @ 03:00 PM (CEST)

Virtual

Wed 29 Jul 2026 @ 11:00 AM (EDT)

TechTalk: On-Premise SD-WAN Management

Virtual

Thu 30 Jul 2026 @ 10:00 AM (PDT)

AI Security Masters E12: READY OR NOT: Securing the AI Enterprise 4/5 - AI Gateway

In-Person

Tue 11 Aug 2026 @ 11:30 AM (EDT)

New York City: Agentic AI Security Deep Dive & Hands-On

In-Person

Thu 13 Aug 2026 @ 11:30 AM (EDT)

Waltham, MA: Agentic AI Security Deep Dive & Hands-On

In-Person

Thu 20 Aug 2026 @ 08:30 AM (COT)

Medellin: Workspace Evolution: Hybrid Mesh Management - Visibilidad, Automatización e IA

In-Person

Thu 20 Aug 2026 @ 06:00 PM (COT)

Medellin: Workspace Intelligence: IA Generativa en Acción para Equipos de Seguridad

In-Person

Thu 27 Aug 2026 @ 09:00 AM (CEST)

Check Point Hands-On SASE and Cloud Workshop - Zurich

In-Person

Wed 21 Oct 2026 @ 09:00 AM (BST)

AI Security Workshop - Glasgow

CheckMates Events

Top

About CheckMates

Learn Check Point

Advanced Learning

Resources

Non-English Discussions

YOU DESERVE THE BEST SECURITY

We’re Social. Follow Us CheckMates on LinkedIn Check Point on YouTube CheckMates on Facebook CheckMates on Instagram

©1994-2026 Check Point Software Technologies Ltd. All rights reserved. Copyright Privacy Policy About Us UserCenter

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.