AI and VoIP Blog

VOIP | AI | Cloud | Kamailio | Open Source


Easily Manage SSH Access with One-Click iTerm2 Profiles

iTerm2 iTerm profiles

If you frequently SSH into remote servers, managing connections can be tedious. iTerm2, a powerful terminal for macOS, makes this easier with custom profiles that let you connect to servers instantly. In this post, I’ll show you how to set up profiles for both single and multiple server connections. With one-click access, you can streamline your workflow and eliminate repetitive logins.

Setting Up Single Server Profile

  1. Open iTerm2 → Preferences (⌘+,)
  2. Navigate to “Profiles” tab
  3. Click “+” to create a new profile
  4. Configure the profile:
  • Name: Give it a descriptive name (e.g., “Production Server”)
  • ShortCut Key: Select a key from drop-down
  • Select “Command” under Command drop-down
  • Enter your SSH command:
    ssh username@server.example.com

Setting Up Multi-Server Profile with Split Panes

To connect to multiple servers simultaneously in split panes:

  1. Create a new profile as above
  2. Select “Login Shell” under Command drop-down
  3. ShortCut Key: Select a key from drop-down
  4. In “Send text at start:”, use an AppleScript command:
  5. Example AppleScript commands are given below:
   # For 2 servers (horizontal split)
   /usr/bin/osascript -e 'tell application "iTerm" to tell current window to set newTab to (create tab with default profile)' && /usr/bin/osascript -e 'tell application "iTerm" to tell current session of current window to split horizontally with default profile' && /usr/bin/osascript -e 'tell application "iTerm" to tell first session of current tab of current window to write text "ssh user@server1.example.com"' && /usr/bin/osascript -e 'tell application "iTerm" to tell second session of current tab of current window to write text "ssh user@server2.example.com"'
   # For 3 servers (horizontal splits)
   /usr/bin/osascript -e 'tell application "iTerm" to tell current window to set newTab to (create tab with default profile)' && /usr/bin/osascript -e 'tell application "iTerm" to tell current session of current window to split horizontally with default profile' && /usr/bin/osascript -e 'tell application "iTerm" to tell current session of current window to split horizontally with default profile' && /usr/bin/osascript -e 'tell application "iTerm" to tell first session of current tab of current window to write text "ssh user@server1.example.com"' && /usr/bin/osascript -e 'tell application "iTerm" to tell second session of current tab of current window to write text "ssh user@server2.example.com"' && /usr/bin/osascript -e 'tell application "iTerm" to tell third session of current tab of current window to write text "ssh user@server3.example.com"'

Quick Access

  • Use ⌘O to open the profiles window
  • Access profiles from the iTerm2 menu bar → Profiles
  • Enable Toolbelt for easy profile access:
  • View → Toggle Toolbelt (⌘+ shift+B)
  • Click “Profiles” in the Toolbelt, you should profile in the Toolbelt
  • Simply click on a profile to launch it or Use shortkut Keys

The Toolbelt provides a persistent sidebar with all your profiles, making it incredibly convenient to launch SSH connections with a single click. But that’s not all—the Toolbelt also offers several other useful options, such as quick access to your command history, Codecierge, and more. This setup works great for anyone who regularly needs to access multiple servers simultaneously. Plus, the profiles persist across iTerm2 sessions, ensuring a seamless experience every time you use it. With the Toolbelt, you can enhance your workflow in many ways, making it a versatile solution for your daily SSH needs.
If you are interested in learning about iTerm2 AI features then check my article here

Leave a Reply

Join 49 other subscribers

Akash Gupta
Senior VoIP Engineer and AI Enthusiast



Discover more from AI and VoIP Blog

Subscribe to get the latest posts sent to your email.



Leave a Reply

Discover more from AI and VoIP Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading