Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts

Thursday, November 21, 2024

SSH Engines broken by November 12, 2024 Windows update

If you are using SSH engines that rely on OpenSSH (and not PuTTY), you may find that they stopped working after the November 23 Windows 11 update.  The reason is that OpenSSH has been updated to version 9.5 and this affects how the scp command works. It now uses the SFTP mode by default and it breaks compatibility with earlier versions.

To fix this, you need to edit the settings of your ssh engine and add a new option –O to the scp command options.  This options instructs scp to work in a backward compatible manner.  With this change you will find that your SSH engines work as before the update.

Friday, January 11, 2019

SSH Engines using Putty

In addition to OpenSSH, PyScripter 3.6 support the use of PuTTY for connecting to remote engines using SSH.  PuTTY is an easy to use and popular SSH client.   After you download PuTTY you can use to connect to remote machines either:
  • using user name and password or
  • by setting up a public/private key combination and setting up a password-free login using the pagent utility
PyScripter supports both modes of connection, but clearly the password-free login is faster and easier once you make the effort to set it up.  This video, among others, explains how to do this.

Here is a sample SSH engine configuration using putty:


You need to provide:
  • the user name
  • the host name (ip address)
  • the paths to the scp and plink commands of putty.  (plink is putty's ssh command)
  • the server name used to identify this SSH engine
  • ssh and scp options (if needed)
  • the command that will be used to run python in the server
  • if you have not setup a password-free connection then check the "Password Needed" option.
Then use the Run, Python Engine, SSH menu option to connect to a remote machine.   If a password is needed PyScripter will prompt you for the password.  Also if you connect the server (host machine) for the first time,  PyScripter will warn you about an "unknown server" and ask you whether you want to proceed.   Everything is hanlded automatically.  And there you are:


You can now run and debug programs on the remote server.  You can also open and edit remote files in the editor and save them back to the server as if they were local.

Wednesday, October 17, 2018

New Feature: Run and Debug files on remote Windows and Linux machines using SSH

As hinted, the forthcoming version 3.5 of PyScripter will allow you to run and debug scripts on remote Windows and Linux SSH servers.  It introduces a new type of engine called "SSH engine",   which runs a python interpreter in a remote Windows or Linux computer or inside a virtual machine.  You first need to define one or more SSH servers as explained here .  This post also describes the requirements for using SSH with PyScripter.  Once you choose this type of engine you need to select a defined SSH server. PyScripter starts a python engine on the remote server using SSH and communicates with it using rpyc.  You can then run and debug remote or local scripts on the SSH server as if the scripts were running locally.  You can also use python running inside the SSH server with the Python Interactive Interpreter. While debugging, tracing into remote modules works transparently for the user.  If you are running python 2.x locally the remote version also needs to be 2.x and similarly if you run python version 3.x locally the remote version needs to be 3.x.  Beyond this constraint, the local and remote versions do not need to be the same.

Friday, October 5, 2018

Working with Remote Files. Preview of new feature.

In the next version, Pyscripter will support working with remote files i.e. files that may reside in different computers (servers) including Windows and Linux machines. You will be able to open, edit run debug and save back these files.  They work seamlessly with other PyScripter features such as the Recent File list, project files, and Run Configurations.
Requirements
To use PyScripter with remote files your computer need to have SSH client capabilities at the computer running PyScripter and an SSH server running on the remote computer.  SSH is a widely used network protocol for securely connecting to remote machines.  Windows 10 since the April 2018 update includes SSH. With earlier versions of Windows 10 you need to manually enable SSH through "Enable Optional Features".  For other versions of Windows you can install the latest version of OpenSSH for Windows using the provided installation instructions.

Configuring the SSH client side
Pyscripter requires password-less authentication using rsa keys.  You need to create the rsa keys and add them to the ssh-agent service which needs to be running.  Your public key needs to be added to the ~/.ssh/authorised_keys file on the server side.  Instructions are provided here.



Configuring the SSH server side

The SSH server service (sshd) and SSH agent service (ssh-agent) need to be running on the server side.  This is most likely true for Linux machines.  In Windows machines you need to start the server using the
    net start sshd
    net start ssh-agent
commands.   You can also configure these services to run automatically.

Testing the SSH connection
From a command prompt issue the following command:
    ssh username@hostname

where username is the user name on the server side and host name is the IP address of the SSH server.  If this works and you see the server shell, then PyScripter is ready to use the Server.




Opening remote files

You can open remote files using the File Menu.  You are then shown the Open Remote File dialog shown below:



In this dialog box you provide the path to the remote file and select an SSH server from a drop-down list.  You can also setup your SSH servers by pressing the button next to the SSH server field.   In PyScripter remote file names are shown in the UNC format \\server name\filepath.
Setting up SSH Servers


In this dialog box you add remove or modify SSH servers.  
Editing SSH sever information


For each SSH server you need to provide a Name that will be used to identify the server, as well as the user name and host name (or IP address) that will be used to connect to the server.  You also need to provide the command that will be used to execute Python on the server.