{"id":933,"date":"2024-10-21T10:24:11","date_gmt":"2024-10-21T14:24:11","guid":{"rendered":"https:\/\/carleton.ca\/rcs\/?page_id=933"},"modified":"2026-04-09T11:58:04","modified_gmt":"2026-04-09T15:58:04","slug":"connecting-to-rcdc-using-vs-code-windows","status":"publish","type":"page","link":"https:\/\/carleton.ca\/rcs\/rcdc\/connecting-to-rcdc-using-vs-code-windows\/","title":{"rendered":"Connecting to RCDC using VS Code (Windows)"},"content":{"rendered":"\n<section class=\"w-screen px-6 cu-section cu-section--white ml-offset-center md:px-8 lg:px-14\">\n    <div class=\"space-y-6 cu-max-w-child-5xl  md:space-y-10 cu-prose-first-last\">\n\n            <div class=\"cu-textmedia flex flex-col lg:flex-row mx-auto gap-6 md:gap-10 my-6 md:my-12 first:mt-0 max-w-5xl\">\n        <div class=\"justify-start cu-textmedia-content cu-prose-first-last\" style=\"flex: 0 0 100%;\">\n            <header class=\"font-light prose-xl cu-pageheader md:prose-2xl cu-component-updated cu-prose-first-last\">\n                                    <h1 class=\"cu-prose-first-last font-semibold !mt-2 mb-4 md:mb-6 relative after:absolute after:h-px after:bottom-0 after:bg-cu-red after:left-px text-3xl md:text-4xl lg:text-5xl lg:leading-[3.5rem] pb-5 after:w-10 text-cu-black-700 not-prose\">\n                        Connecting to RCDC using VS Code (Windows)\n                    <\/h1>\n                \n                                \n                            <\/header>\n\n                    <\/div>\n\n            <\/div>\n\n    <\/div>\n<\/section>\n\n\n\n<h2 id=\"overview\" class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p>The Visual Studio Code editor is able to connect to a Linux server using SSH, to remotely edit, run, and debug code.&nbsp; VS Code can also upload\/download files, and open a shell command session on the Linux server.<\/p>\n\n\n\n<p>To make a secure and more convenient connection to the server we will use SSH keys, which enables a remote session without repeatedly typing in your password.<\/p>\n\n\n\n<h2 id=\"initial-configuration\" class=\"wp-block-heading\">Initial Configuration<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Ensure that the OpenSSH Client is installed on your Windows laptop.\u00a0 It is probably already there, but if not you can install it in your Windows Settings at Apps > Apps and Features > Manage Optional Features<\/li>\n<\/ol>\n\n\n\n<p>2. The server is not publicly accessible, so if you are off-campus or on wireless, connect to the <a href=\"https:\/\/carleton.ca\/its\/help-centre\/remote-access\/\">Carleton VPN<\/a>.<\/p>\n\n\n\n<p>3. In VS Code, install the <a href=\"vscode:extension\/ms-vscode-remote.remote-ssh\" class=\"install-extension-btn\">Remote &#8211; SSH extension<\/a><\/p>\n\n\n\n<p>4. In VS Code, connect to the server by pressing the Remote Window button in the bottom left:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"276\" height=\"137\" src=\"https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-remote-button.png\" alt=\"screenshot of VS Code with an arrow pointing to the Remote button.\" class=\"wp-image-939\" srcset=\"https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-remote-button.png 276w, https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-remote-button-160x79.png 160w, https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-remote-button-240x119.png 240w\" sizes=\"auto, (max-width: 276px) 100vw, 276px\" \/><\/figure>\n\n\n\n<p>select Connect to host&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1210\" height=\"238\" src=\"https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-connect-to-host.png\" alt=\"screenshot of VS Code, Remote options.\" class=\"wp-image-940\" srcset=\"https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-connect-to-host.png 1210w, https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-connect-to-host-160x31.png 160w, https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-connect-to-host-240x47.png 240w, https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-connect-to-host-768x151.png 768w, https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-connect-to-host-400x79.png 400w, https:\/\/carleton.ca\/rcs\/wp-content\/uploads\/sites\/234\/vscode-connect-to-host-360x71.png 360w\" sizes=\"auto, (max-width: 1210px) 100vw, 1210px\" \/><\/figure>\n\n\n\n<p>For your username and IP address, type <em class=\"myprefix-text-italic\">ssh username@134.117.214.XX<\/em><br><br>A new Code window will open, and it will ask you for your password.\u00a0 Type in the provided password.\u00a0 You might be asked for your password again until you have installed the ssh key on your server!<\/p>\n\n\n\n<p>5. Create an SSH Key on your Windows laptop by running this in a Command Prompt:<br><\/p>\n\n\n<div class=\"not-prose cu-quote cu-component-spacing\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>ssh-keygen -t ed25519<\/p>\n<\/blockquote>\n<\/div>\n\n\n<p>6. In a VS Code remote server session, press CTRL-` to start a remote shell terminal, and run these commands:<br><\/p>\n\n\n<div class=\"not-prose cu-quote cu-component-spacing\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>mkdir -p ~\/.ssh<br><br>chmod 700 ~\/.ssh<br><br>touch ~\/.ssh\/authorized_keys<br><br>chmod 600 ~\/.ssh\/authorized_keys<\/p>\n<\/blockquote>\n<\/div>\n\n\n<p>7. In VS Code, open the <em class=\"myprefix-text-italic\">.ssh\/authorized_keys<\/em> file on the server, and paste the contents of the following file from\u00a0 your local Windows laptop:<em class=\"myprefix-text-italic\"> %USERPROFILE%\\.ssh\\id_ed25519.pub<\/em><\/p>\n\n\n\n<p>After these steps have been successfully completed, you should be able to use develop code on the server.&nbsp; To reconnect later, you will need to ensure the VPN is running, and then connect to the server again.<\/p>\n\n\n\n<h2 id=\"running-code-while-disconnected\" class=\"wp-block-heading\">Running code while disconnected<\/h2>\n\n\n\n<p>A common purpose for the Linux server is to provide you with a place that you can run code which takes a long time to complete.&nbsp; For this, you will need to use special Linux commands to start your code.<\/p>\n\n\n\n<p>One suggested command is Task Spooler.&nbsp; In your remote session in VS Code, press CTRL-` to open a shell and then use the commands described here:<\/p>\n\n\n\n<p><a href=\"https:\/\/carleton.ca\/rcs\/rcdc\/background-queue-of-jobs\/\">Background queue of jobs<\/a><\/p>\n\n\n\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview The Visual Studio Code editor is able to connect to a Linux server using SSH, to remotely edit, run, and debug code.&nbsp; VS Code can also upload\/download files, and open a shell command session on the Linux server. To make a secure and more convenient connection to the server we will use SSH keys, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":96,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_cu_dining_location_slug":"","footnotes":"","_links_to":"","_links_to_target":""},"cu_page_type":[],"class_list":["post-933","page","type-page","status-publish","hentry"],"acf":{"cu_post_thumbnail":""},"_links":{"self":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/comments?post=933"}],"version-history":[{"count":4,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/933\/revisions"}],"predecessor-version":[{"id":1155,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/933\/revisions\/1155"}],"up":[{"embeddable":true,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/96"}],"wp:attachment":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/media?parent=933"}],"wp:term":[{"taxonomy":"cu_page_type","embeddable":true,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/cu_page_type?post=933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}