Streamlining Pi Board Development with WinSCP and SSH

Posted by:

|

On:

|

Connecting a keyboard and a monitor directly to a Pi-based board for development can often be cumbersome, as it requires additional space for an extra monitor and keyboard alongside my PC. To streamline this process, I typically opt for network connectivity by connecting my PC to the Pi board using WinSCP and Putty SSH. Not only does WinSCP offer a user-friendly file manager, but its accompanying editor, like Note++, provides a much simpler alternative to command mode editors like nano in the Linux.

Additionally, I must admit that I often find myself using the wrong keyboard when working with multiple devices simultaneously. The convenience of WinSCP and Putty SSH allows me to bypass the need for a physical keyboard connected directly to the Pi board, minimizing the chances of keyboard mix-ups and reducing potential frustrations. Certainly, if the IP settings of the Pi-based board are lost or forgotten, it becomes necessary to connect a monitor and keyboard to it to reestablish the network connection.

In this article, I will share my configuration tips for WinSCP to make the entire development experience more seamless and hassle-free.

Download sites

WinSCP: https://winscp.net/eng/download.php

Putty: https://www.chiark.greenend.org.uk/~sgtatham/putty

The installation process is straightforward and will not be covered in this article.

Configuration

I assume that both the Pi-based board and the PC are already successfully connected with the correct network settings in place.

(1) Run Sudo command in WinSCP

In typical Linux operations, it is common to include ‘sudo’ when executing file management commands. Similarly, when using WinSCP for file management, it is necessary to run the ‘sudo’ command to ensure proper permissions and access.

To add the ‘sudo’ command, click on the “New Tab” option to open a fresh login window, and then click the ‘Edit’ button.

Press ‘Advanced’ button.

In the Advanced Site Settings window, select “sudo su -” for the Shell option. Click the ‘OK’ button followed by the ‘Save’ button to save the configuration.

(2) Enable remote refresh

Go to the top menu and select “Options” followed by “Preferences”.

In the left panel, choose “Remote” under “Panels”. Check the box for “Refresh remote panel every” and set the interval to 10 seconds. Click the ‘OK’ button o save the configuration.

(3) Add Putty to WinSCP

Type “putty” in the window search. Right click on the Putty App to open the pop-up menu and select “Open file location”

Right click on the shortcut Putty to open the pop-up menu and select “Open file location”

Right click on the putty.exe to open the pop-up menu and select “Copy as path”.

Then, go to the top menu and select “Options” followed by “Preferences”.

In the left panel, choose “Application” under “Integration”. Right click on the text box under “PuTTY/Terminal client path:”. Select “Paste” on the pop up menu to paste the path onto the text box.

After pasting the path, check the box for “Remember session password and pass it to PuTTY (SSH)”. Finally click the ‘OK’ button to save the configuration.

SOP for using WinSCP and Putty

(1) Session connect and disconnect

Click “New Tab” at the top of WinSCP window to open a fresh login window. Select the session name at the left panel and click the ‘Login’ button.

When both the username and password are correct, WinSCP will log in and establish a network connection to the Pi. Once connected, you will be able to view the directories and files at both the local and remote sites.

To disconnect the session, simply click on the small ‘x’ located on the tab displaying the session name.

(2) File Manager

When you right-click on any file or directory, a context menu will appear, offering various user-friendly window manager features such as Open, Edit, Duplicate, Move To, Delete, and Rename. For editing text files, you can utilize your preferred GUI editor like Note++ by double click the file. Additionally, you can easily move files and directories between local and remote sites by simply dragging and dropping them.

(3) Change persmission for files and directories

To access the permission setting of any file or directory, simply right-click on it and select “Properties” from the context menu.

In the Properties window, you have the option to set the Read, Write, and Execute permissions for the Owner, Group, and Others.

(4) Add link for path

Links in Linux are used in many instances: Sometimes to create a convenient path to a directory buried deep within the file hierarchy; other uses for links include: Linking libraries. Making sure files are in constant locations (without having to move the original) Keeping a “copy” of a single file in multiple locations. You can create a new link easily in WinSCP. Navigate to the desired directory, then right-click on the caption to access the context menu. From the menu, select the option “Copy Path to Clipboard”. In the example provided below, I aim to create a link for the directory “/home/user/SIM7600X-4G-HAT-Demo/Raspberry/”.

Navigate to the directory where you would like to create the link. In the example below, I choose “/home/user”. Right-click on the file manager and select the “Link” option from the context menu, which can be found under the “New” category.

Paste the copied path into the text box labeled “Point link/shortcut to:”. Then, provide a name, ‘Pi’ in the example below, for the link in the “Link/shortcut file:” field.

Upon clicking the OK button, a new link with a ‘shortcut folder’ icon will be created, named “Pi”.

Open PuTTY and log in to the directory “/home/user”. You will notice a shortcut named “Pi” highlighted in green color.

By typing “cd Pi” followed by “ls” in the PuTTY terminal, you can directly navigate to the directory “/home/user/SIM7600X-4G-HAT-Demo/Raspberry/”.

(5) Open Putty in WinSCP directly

To open the Putty Terminal, click on the Putty icon located under the main menu. You can easily identify the icon as it is enclosed by a red square in the diagram below. It is worth noting that the username and password will be automatically passed to Putty, eliminating the need for manual intervention.

There is a logging feature in PuTTY that allows you to save all the command responses for future reference and analysis. To enable this functionality, right-click on the caption of the PuTTY window and select “Change Settings…” from the menu bar.

In the PuTTY Configuration menu, click the “Logging” under Session. Enable the option for “Printable output” and specify a new file name, such as putty.log, in the “Log file name” field. Finally, click the “Apply” button to save the settings.

After configuring the settings as mentioned, any text displayed on the terminal will automatically be saved to the file named “putty.log”.

Utilize WinSCP to open the “putty.log” file and you will find that all displayed text has been successfully saved within it.

Please be aware that once the PuTTY session is disconnected, you will need to enable session logging again for each new connection.

Posted by

in