element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Automatically connect Windows Terminal to a Linux device with certificates
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 1 reply
  • Subscribers 663 subscribers
  • Views 1808 views
  • Users 0 members are here
  • openssh
  • raspberrypi
Related

Automatically connect Windows Terminal to a Linux device with certificates

Jan Cumps
Jan Cumps over 3 years ago

This little post shows a way to automatically open a Linux session in Windows Terminal, authenticated with your personal key.
A full logon without having to reveal the password.
I'm showing how I did this for a Raspberry Pi.

Requirements and expectations:

  • ssh is enabled on the Linux device
  • have an exisiting public / private keypair in openSSH format handy, or create one. Internet will help to create one if you don't have it.
    If you use PuttyGen to generate a key pair, export the private key in OpenSSH format.
  • have the public key added to the Linux device's ~/.ssh/authorized_keys file

I created two batch files.
One that knows how to open an SSH session, called daq.bat (because the Pi I'm connecting to is going to be a daq for a Road Test - but I digress).

ssh raspberry4daq -l pi -i "C:\Users\jancu\Documents\elektronica\certificates\rsa_jc.priv.openssh"

  • raspberry4daq is the name of my Pi, as entered in raspi-config
  • -l pi is my user
  • -i "<private key file> is the location of my private key certificate, on the Windows computer that will run the batch files. In openSSH format

The second batch file, called daqterminal.bat, opens Windows Terminal, and executes the first batch file.

"%LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe" "C:\Users\jancu\Documents\elektronica\digilent\mcc dac\daq.bat"

The first part is fixed, and will start the Windows Terminal.
The second part is the full path of the first batch file. Terminal will execute it when it starts.

Result, when double-clicking on the second batch file:

image

If you run this batch file the first time, and you haven't SSH'd into the Linux box before, it will ask you to accept the server certificate:

The authenticity of host '************' can't be established.
ECDSA key fingerprint is ************************.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

If you trust the server (hey, it's your own Pi), answer yes. The server will be trusted for SSH communication from then on and you will not be prompted again.
Check the internet for the no/[fingerprint] options. They may be your best choice when using a server that you don't trust (yet).

  • Sign in to reply
  • Cancel
Parents
  • Jan Cumps
    Jan Cumps over 3 years ago

    If you prefer the traditional CMD prompt window, just double-click on the first batch file.

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Jan Cumps
    Jan Cumps over 3 years ago

    If you prefer the traditional CMD prompt window, just double-click on the first batch file.

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube