## 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.](https://community.checkpoint.com/t5/forums/v5/forumtopicpage.kudosbuttonv2.kudoentity:kudoentity/kudosable-gid/52299?t:ac=board-id/general-topics/thread-id/10357&t:cp=kudos/contributions/tapletcontributionspage&ticket=u03D7h5TCTYD_-1 "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](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299)

- [All forum topics](https://community.checkpoint.com/t5/General-Topics/bd-p/general-topics/page/374 "General Topics")
- [Previous Topic](https://community.checkpoint.com/t5/General-Topics/need-checkpoint-document-that-has-details-of-all-field-that-are/td-p/51926 "need checkpoint document that has details of all field that are in logs")
- [Next Topic](https://community.checkpoint.com/t5/General-Topics/VSX-Cluster-Performance-Issues/td-p/13753 "VSX Cluster Performance Issues")

3 Replies

[Nick\_Doropoulos](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/19974)

Advisor

‎2019-05-0112:45 PM

[Show option menu](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299# "Show option menu")

- Mark as New
- Bookmark
- Subscribe
- Mute
- [Subscribe to RSS Feed](https://community.checkpoint.com/rss/message?board.id=general-topics&message.id=10360)
- [Permalink](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/m-p/52342/highlight/true#M10360)
- [Print](https://community.checkpoint.com/t5/forums/forumtopicprintpage/board-id/general-topics/message-id/10360/print-single-message/true/page/1)
- [Report Inappropriate Content](https://community.checkpoint.com/t5/notifications/notifymoderatorpage/message-uid/52342)

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.

2) 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:

3) Finally, press Escape followed by _:wq_ to save the changes. The end result can be seen below next time you login:

4) 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.](https://community.checkpoint.com/t5/forums/v5/forumtopicpage.kudosbuttonv2.kudoentity:kudoentity/kudosable-gid/52342?t:ac=board-id/general-topics/thread-id/10357&t:cp=kudos/contributions/tapletcontributionspage&ticket=u03D7h5TCTYD_-1 "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](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299)

[Lisa11](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/28134)

Explorer

‎2019-05-0212:46 AM

[Show option menu](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299# "Show option menu")

- Mark as New
- Bookmark
- Subscribe
- Mute
- [Subscribe to RSS Feed](https://community.checkpoint.com/rss/message?board.id=general-topics&message.id=10370)
- [Permalink](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/m-p/52389/highlight/true#M10370)
- [Print](https://community.checkpoint.com/t5/forums/forumtopicprintpage/board-id/general-topics/message-id/10370/print-single-message/true/page/1)
- [Report Inappropriate Content](https://community.checkpoint.com/t5/notifications/notifymoderatorpage/message-uid/52389)

[In response to Nick\_Doropoulos](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/m-p/52342/highlight/true#M10360)

> * * *
>
> [@Nick\_Doropoulos](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/19974) 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.
>
> 2) 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](https://www.diebestetest.de/)_
>
> _date_
>
> Have a look at this screenshot as well if needed:
>
> 
>
> 3) Finally, press Escape followed by _:wq_ to save the changes. The end result can be seen below next time you login:
>
> 
>
> 4) 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.](https://community.checkpoint.com/t5/forums/v5/forumtopicpage.kudosbuttonv2.kudoentity:kudoentity/kudosable-gid/52389?t:ac=board-id/general-topics/thread-id/10357&t:cp=kudos/contributions/tapletcontributionspage&ticket=u03D7h5TCTYD_-1 "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](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299)

[PhoneBoy](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/7)

Admin

‎2019-05-0109:14 PM

[Show option menu](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299# "Show option menu")

- Mark as New
- Bookmark
- Subscribe
- Mute
- [Subscribe to RSS Feed](https://community.checkpoint.com/rss/message?board.id=general-topics&message.id=10367)
- [Permalink](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/m-p/52377/highlight/true#M10367)
- [Print](https://community.checkpoint.com/t5/forums/forumtopicprintpage/board-id/general-topics/message-id/10367/print-single-message/true/page/1)
- [Report Inappropriate Content](https://community.checkpoint.com/t5/notifications/notifymoderatorpage/message-uid/52377)

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.](https://community.checkpoint.com/t5/forums/v5/forumtopicpage.kudosbuttonv2.kudoentity:kudoentity/kudosable-gid/52377?t:ac=board-id/general-topics/thread-id/10357&t:cp=kudos/contributions/tapletcontributionspage&ticket=u03D7h5TCTYD_-1 "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](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299)

Post Reply

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

| User | Count |
| --- | --- |
| <br>[israelfds95](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/93117) | 13 |
| <br>[HeikoAnkenbrand](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/21670) | 7 |
| <br>[simonemantovani](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/79070) | 5 |
| <br>[emmap](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/71054) | 3 |
| <br>[Steffen\_Appel](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/10477) | 2 |
| <br>[Kaspars\_Zibarts](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/11456) | 1 |
| <br>[Alex-](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/10384) | 1 |
| <br>[Danny](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/687) | 1 |
| <br>[Bob\_Zimmerman](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/27871) | 1 |
| <br>[DH](https://community.checkpoint.com/t5/user/viewprofilepage/user-id/25118) | 1 |

[View All ≫](https://community.checkpoint.com/t5/forums/kudosleaderboardpage/board-id/general-topics/timerange/one_month/page/1/tab/authors)

Trending Discussions

[Five Habits That Improved My Check Point Deployments](https://community.checkpoint.com/t5/General-Topics/Five-Habits-That-Improved-My-Check-Point-Deployments/td-p/279760)

[Automatically Renew VPN Certificates](https://community.checkpoint.com/t5/General-Topics/Automatically-Renew-VPN-Certificates/td-p/279072)

[Snapshot and /boot disk space full](https://community.checkpoint.com/t5/General-Topics/Snapshot-and-boot-disk-space-full/td-p/280183)

Upcoming Events

Sort by:

- [All](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299#)
- [Virtual](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299#)
- [In-Person](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299#)

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[Under the Hood - Check Point and Illumio – Modern Network Defense Against AI-Based Threats](https://community.checkpoint.com/t5/CheckMates-Events/Under-the-Hood-Check-Point-and-Illumio-Modern-Network-Defense/ev-p/279701)

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[The AI Security Report 2026: A Turning Point for Enterprise Defense - SGT](https://community.checkpoint.com/t5/CheckMates-Events/The-AI-Security-Report-2026-A-Turning-Point-for-Enterprise/ev-p/280019)

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[The AI Security Report 2026: A Turning Point for Enterprise Defense - AMER](https://community.checkpoint.com/t5/CheckMates-Events/The-AI-Security-Report-2026-A-Turning-Point-for-Enterprise/ev-p/280021)

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[The AI Security Report 2026: A Turning Point for Enterprise Defense EMEA](https://community.checkpoint.com/t5/CheckMates-Events/The-AI-Security-Report-2026-A-Turning-Point-for-Enterprise/ev-p/280020)

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[TechTalk: On-Premise SD-WAN Management](https://community.checkpoint.com/t5/CheckMates-Events/TechTalk-On-Premise-SD-WAN-Management/ev-p/279370)

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

[CheckMates Live DFW: Agentic AI Security Deep Dive & Hands-On](https://community.checkpoint.com/t5/CheckMates-Events/CheckMates-Live-DFW-Agentic-AI-Security-Deep-Dive-amp-Hands-On/ev-p/279920)

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[TechTalk: On-Premise SD-WAN Management](https://community.checkpoint.com/t5/CheckMates-Events/TechTalk-On-Premise-SD-WAN-Management/ev-p/279370)

[Virtual](https://community.checkpoint.com/labels/Virtual)

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

[AI Security Masters E12: READY OR NOT: Securing the AI Enterprise 4/5 - AI Gateway](https://community.checkpoint.com/t5/CheckMates-Events/AI-Security-Masters-E12-READY-OR-NOT-Securing-the-AI-Enterprise/ev-p/277411)

[In-Person](https://community.checkpoint.com/labels/In-Person)

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

[New York City: Agentic AI Security Deep Dive & Hands-On](https://community.checkpoint.com/t5/CheckMates-Events/New-York-City-Agentic-AI-Security-Deep-Dive-amp-Hands-On/ev-p/279476)

[In-Person](https://community.checkpoint.com/labels/In-Person)

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

[Waltham, MA: Agentic AI Security Deep Dive & Hands-On](https://community.checkpoint.com/t5/CheckMates-Events/Waltham-MA-Agentic-AI-Security-Deep-Dive-amp-Hands-On/ev-p/279475)

[In-Person](https://community.checkpoint.com/labels/In-Person)

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

[Medellin: Workspace Evolution: Hybrid Mesh Management - Visibilidad, Automatización e IA](https://community.checkpoint.com/t5/CheckMates-Events/Medellin-Workspace-Evolution-Hybrid-Mesh-Management-Visibilidad/ev-p/280003)

[In-Person](https://community.checkpoint.com/labels/In-Person)

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

[Medellin: Workspace Intelligence: IA Generativa en Acción para Equipos de Seguridad](https://community.checkpoint.com/t5/CheckMates-Events/Medellin-Workspace-Intelligence-IA-Generativa-en-Acci%C3%B3n-para/ev-p/280004)

[In-Person](https://community.checkpoint.com/labels/In-Person)

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

[Check Point Hands-On SASE and Cloud Workshop - Zurich](https://community.checkpoint.com/t5/CheckMates-Events/Check-Point-Hands-On-SASE-and-Cloud-Workshop-Zurich/ev-p/279914)

[In-Person](https://community.checkpoint.com/labels/In-Person)

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

[AI Security Workshop - Glasgow](https://community.checkpoint.com/t5/CheckMates-Events/AI-Security-Workshop-Glasgow/ev-p/278505)

[CheckMates Events](https://community.checkpoint.com/t5/CheckMates-Events/eb-p/events)

[Top](https://community.checkpoint.com/t5/General-Topics/Python-Pexpect-and-Check-Point-Gaia-Expert-Mode/td-p/52299)

About CheckMates

- [Getting Started & FAQ](https://community.checkpoint.com/t5/help/faqpage)
- [Community Guidelines](https://community.checkpoint.com/t5/user/TermsOfServicePage)

Learn Check Point

- [Check Point for Beginners](https://community.checkpoint.com/t5/Check-Point-for-Beginners-2-0/bg-p/check-point-for-beginners-2-0)
- [Check Point Trivia](https://community.checkpoint.com/t5/Check-Point-Trivia/bg-p/trivia)
- [CheckFlix Videos](https://community.checkpoint.com/t5/CheckFlix/ct-p/checkflix)

Advanced Learning

- [Check Point Security Masters](https://community.checkpoint.com/t5/Check-Point-Security-Masters/gp-p/ccsm)
- [Tip of the Week](https://community.checkpoint.com/t5/SecureKnowledge-Tip-of-the-Week/bg-p/secureknowledge)
- [TechTalks](https://community.checkpoint.com/t5/TechTalks/ct-p/techtalks%20role=)
- [Training and Certification](https://community.checkpoint.com/t5/Training-and-Certification/bd-p/training-and-certification)

Resources

- [CheckMates Toolbox](https://community.checkpoint.com/t5/CheckMates-Toolbox/ct-p/CheckMatesToolbox)
- [Developers (Code Hub)](https://community.checkpoint.com/t5/Developers-API-CLI/bd-p/codehub)
- [Product Announcements](https://community.checkpoint.com/t5/Product-Announcements/bg-p/products-blog)
- [Upcoming Events](https://community.checkpoint.com/t5/Upcoming-Events/bg-p/checkmates-live)

Non-English Discussions

- [Español](https://community.checkpoint.com/t5/Espa%C3%B1ol/bd-p/spanish)
- [French](https://community.checkpoint.com/t5/Fran%C3%A7ais/bd-p/francais)
- [Japanese](https://community.checkpoint.com/t5/Japanese-%E6%97%A5%E6%9C%AC%E8%AA%9E/bd-p/Japanese)
- [Português](https://community.checkpoint.com/t5/Portugu%C3%AAs/bd-p/portuguese)
- [Russian](https://community.checkpoint.com/t5/Russian/bd-p/russian)
- [Chinese](https://community.checkpoint.com/t5/Chinese/bd-p/taiwan)

YOU DESERVE THE BEST SECURITY

We’re Social. Follow Us [CheckMates on LinkedIn](http://linkedin.com/company/cpcheckmates)  [Check Point on YouTube](https://www.youtube.com/user/CPGlobal) [CheckMates on Facebook](https://www.facebook.com/cpcheckmates/) [CheckMates on Instagram](https://www.instagram.com/cpcheckmates/)

©1994-2026 Check Point Software Technologies Ltd. All rights reserved. [Copyright](https://www.checkpoint.com/copyright/) [Privacy Policy](https://www.checkpoint.com/privacy/) [About Us](https://www.checkpoint.com/about-us/) [UserCenter](https://usercenter.checkpoint.com/)

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.
