Difference between revisions of "Remote file editing"

From Earlham CS Department
Jump to navigation Jump to search
m
(Text editor apps)
 
(13 intermediate revisions by 5 users not shown)
Line 1: Line 1:
It's often good to be able to edit files remotely in an editor. Here are some instructions as to how.
+
It's often good to be able to edit files remotely in an editor. This is much superior (for advanced projects) to Jupyter Notebooks for most purposes. Here are some instructions as to how.
  
 
= At the terminal =
 
= At the terminal =
  
Use vi, vim, nano, or some other editor at the terminal for editing if you want simplicity and do a lot of admin work.
+
Use vi, [[Vim|vim]], nano, or some other editor at the terminal for editing if you want simplicity and do a lot of admin work.
  
= Other editors =
+
= Text editor apps =
  
 
Generally, a text editor will have either a built-in feature or an extension that supports adding SFTP (secure FTP) servers. You'll want to add tools, hopper, or both to your editor.
 
Generally, a text editor will have either a built-in feature or an extension that supports adding SFTP (secure FTP) servers. You'll want to add tools, hopper, or both to your editor.
  
Atom
+
A common pattern is to:
* Install the FTP-remote extension.
+
* download the software (links with each editor),
* Set your password.
+
* add your username and password or ssh key for the server you want,
* Add your servers.
+
* connect,
* Use the SSH port (22) and your ssh key or password.
+
* and save a document to verify that your connection works.
* You can right-click > Edit Servers at any time to add, remove, or change servers.
 
  
These should also work but are not yet documented:
+
[https://www.sublimetext.com/ Sublime] (Commercial (possible to use without cost), OS X, Linux, Windows)
 +
* Download and install.
 +
* Tools > Command Palette > type "package" > Package Control: Install Package > type "sftp" > click first entry
 +
* Now go to File > SFTP/FTP to do tasks like setting up and browsing servers
  
* Sublime
+
[https://www.barebones.com/products/bbedit/ BBEdit] (Was TextWrangler, commercial (with free mode), OS X, installed on the CST Macs)
* TextWrangler
+
* Download and install.
* Notepad++
+
* From the File menu choose "Open from FTP/SFTP Server" and configure tools.cs.earlham.edu as a server.
 +
 
 +
[https://notepad-plus-plus.org/ Notepad++] for Windows
 +
* Download and install. You're almost certain to want the 64-bit version.
 +
* Plugins > Manage plugins > "NppFTP" (if it's not already installed)
 +
* Plugins > NppFTP > Open NppFTP > gear ("Settings") > Profile settings > Add new
 +
 
 +
[https://code.visualstudio.com/ Visual Studio Code (OS X, Linux, Windows)]
 +
* Download and install
 +
* Also make sure that you have OpenSSH installed, which comes standard with most versions of Windows 10 now, by opening Command Prompt or PowerShell and running <code>ssh</code>
 +
** Also, if you have not already, set up an SSH key using these instructions: [[How_To_Set_Up_SSH_Keys]].
 +
* Click on the Extension Tab, and search for "Remote Development Extension Pack"
 +
* Click Install
 +
* Reload the window if prompted
 +
* If it does not prompt you to, open your ssh configs by pressing CTRL+p, then typing ">Remote-SSH: Open Configuration File", and then pressing enter
 +
* The next steps depend on whether you want to work on Tools and/or the Cluster
 +
** Cluster
 +
*** NOTE: As of September 2019, Remote Editing for VSCode does not currently support CentOS versions under 7, so it cannot be run on Hopper.
 +
*** Add the following code snippet to your ssh config file, replacing USERNAME with your username and the path to your ssh.exe if it is not in System32.
 +
<pre>Host pollock bronte
 +
  HostName %h.cluster.earlham.edu
 +
  ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe hopper.cluster.earlham.edu nc %h %p
 +
  User USERNAME
 +
  DynamicForward 1082
 +
 
 +
Host hopper.cluster.earlham.edu
 +
    User USERNAME
 +
</pre>
 +
*** NOTE: you can add more than just bronte and pollock to the Host line; you just need to separate them by spaces.  The config will work the same as long as you've spelled everything correctly!
 +
** Tools
 +
*** Add the following code snippet to your ssh config file.
 +
<pre>Host tools
 +
    HostName tools.cs.earlham.edu
 +
    User USERNAME
 +
</pre>
 +
* After you have done one or both of those instructions, save your config, navigate to the remote editing tab on the left side of the screen, and hit the refresh button.\
 +
* If everything worked correctly, whatever servers you added should appear on the list
 +
 
 +
Tested and working 2022

Latest revision as of 09:47, 23 January 2024

It's often good to be able to edit files remotely in an editor. This is much superior (for advanced projects) to Jupyter Notebooks for most purposes. Here are some instructions as to how.

At the terminal

Use vi, vim, nano, or some other editor at the terminal for editing if you want simplicity and do a lot of admin work.

Text editor apps

Generally, a text editor will have either a built-in feature or an extension that supports adding SFTP (secure FTP) servers. You'll want to add tools, hopper, or both to your editor.

A common pattern is to:

  • download the software (links with each editor),
  • add your username and password or ssh key for the server you want,
  • connect,
  • and save a document to verify that your connection works.

Sublime (Commercial (possible to use without cost), OS X, Linux, Windows)

  • Download and install.
  • Tools > Command Palette > type "package" > Package Control: Install Package > type "sftp" > click first entry
  • Now go to File > SFTP/FTP to do tasks like setting up and browsing servers

BBEdit (Was TextWrangler, commercial (with free mode), OS X, installed on the CST Macs)

  • Download and install.
  • From the File menu choose "Open from FTP/SFTP Server" and configure tools.cs.earlham.edu as a server.

Notepad++ for Windows

  • Download and install. You're almost certain to want the 64-bit version.
  • Plugins > Manage plugins > "NppFTP" (if it's not already installed)
  • Plugins > NppFTP > Open NppFTP > gear ("Settings") > Profile settings > Add new

Visual Studio Code (OS X, Linux, Windows)

  • Download and install
  • Also make sure that you have OpenSSH installed, which comes standard with most versions of Windows 10 now, by opening Command Prompt or PowerShell and running ssh
  • Click on the Extension Tab, and search for "Remote Development Extension Pack"
  • Click Install
  • Reload the window if prompted
  • If it does not prompt you to, open your ssh configs by pressing CTRL+p, then typing ">Remote-SSH: Open Configuration File", and then pressing enter
  • The next steps depend on whether you want to work on Tools and/or the Cluster
    • Cluster
      • NOTE: As of September 2019, Remote Editing for VSCode does not currently support CentOS versions under 7, so it cannot be run on Hopper.
      • Add the following code snippet to your ssh config file, replacing USERNAME with your username and the path to your ssh.exe if it is not in System32.
Host pollock bronte
   HostName %h.cluster.earlham.edu
   ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe hopper.cluster.earlham.edu nc %h %p
   User USERNAME
   DynamicForward 1082

Host hopper.cluster.earlham.edu
    User USERNAME
      • NOTE: you can add more than just bronte and pollock to the Host line; you just need to separate them by spaces. The config will work the same as long as you've spelled everything correctly!
    • Tools
      • Add the following code snippet to your ssh config file.
Host tools
    HostName tools.cs.earlham.edu
    User USERNAME
  • After you have done one or both of those instructions, save your config, navigate to the remote editing tab on the left side of the screen, and hit the refresh button.\
  • If everything worked correctly, whatever servers you added should appear on the list

Tested and working 2022