Configuring sftp with notepad++
In my time as a student, and through the transition to teaching I have found a very useful tool for scripting that some of you may or may not be familiar with. While many people who script in Windows on a regular basis are familiar with Notepad++ and it’s vastly superior usefulness over notepad; you may be unfamiliar that it also has a built-in sftp plugin. This allows seemless connection to files on a remote server, all integrated within the Notepad++ environment. You can open the files on the server (where a copy is downloaded locally behind the scenes) and automatically opened in Notepad++ for you. Then once you’ve made your changes to the local copy, any time you press save it is automatically uploaded back to the server (provided you still have an active network connection).
Before you get too excited about this new found functionality, there are some fairly common sense pitfalls you should be aware of (but may not be aware of).
- When connecting to any remote server, you should select sftp over ftp if the functionality is available on the server you’re connecting to (and if it isn’t, talk to your admin!). With ftp your credentials are sent in clear text. This is very bad. With an sftp connection, there is at least a layer of encryption built into the process, thus limiting the chance your data or credentials are compromised.
- You only need to enter your username, server information and password once (unless it changes). After that, it is a simple act of connect/disconnect with a single button. This leads to pitfall number two. For fairly obvious reasons, this is undesirable in a shared environment. If you decide however to set this up in a shared environment, be careful to remove your credentials at the end of the session; you don’t want someone else being able to log onto a computer and access your files!
Now that we have the introduction out of the way, lets talk about the setup. For simplicity I’m going to assume you’ve already downloaded and installed Notepad++ (if you haven’t, a download link can be found here).
- Open Notepad++ and go to Plugins > NppFTP > Show NppFTP Window
- Click on the cog wheel/gear > Profile Settings
- Click Add New
- Enter in your hostname, port number, username and password (you can select Ask for password if you wish)
- Switch the connection type to SFTP
- Close the window
Note: You can also specify the path to an initial directory to enter on the server upon login.
Note: You can create, move, rename and delete files through the directory tree listed in the NppFTP window.