Skip to content

Latest commit

 

History

History
116 lines (61 loc) · 4.01 KB

cse-15l-lab-report-1.md

File metadata and controls

116 lines (61 loc) · 4.01 KB

Week 2 Lab Report

  1. Installing VScode

Download Visual Studio Code from https://code.visualstudio.com/

VSWebsite

After Visual Studio Code finishes downloading, open it and it should something like this:

VSStart

  1. Remotely Connecting

First install OpenSSH Client and OpenSSH Server by opening Settings > Apps > Apps & features > Optional Features:

Settings

Apps

(Opening Apps & Features may not be necessary since Optional Features can be selected outside Apps & Features, but inside the Apps section)

Apps&Features

Optional Features

(If OpenSSH Client and/or OpenSSH Server do not appear, this may mean that it has already been added)

AddOptionalFeatures

Look for your course-specific account in https://sdacs.ucsd.edu/~icc/index.php

Your CSE 15L account should follow the format of [email protected] where "abc" is different for everything account.

Open Visual Studio Code, and open the terminal. In the terminal, write the command ssh followed by your account. If it is the first time you are connecting remotely to a new server for the first, it will ask you to confirm if you want to continue. Select yes and type your account's password when prompted.

Terminal

After this typing your password, the terminal should look something like this:

SuccessfulLogin

  1. Trying Some Commands

Command lists:

  • ls (used to show the files in the directory)
  • touch (creates a file)
  • cat (Prints the content of the file, if it does not exist, an error is printed)
  • echo (Puts the string inside the file)
  • cp (Makes a copy of a file with another name)

AllCommands

  1. Moving Files with scp

The scp command will copy a file from the local client (your computer) and send it to the remote computers. The command will prompt you for the password before it runs successfully.

The format of the scp command is:

scp Name of the file Your course-specific account:~/

Before using scp command:

EmptyFolder

In client terminal:

scp:

After using scp command:

WhereAmI

  1. Setting an SSH Key

Using the ssh-keygen generates files that allows you to connect to the remote servers without being prompted to put a password every time.

After running ssh-keygen in the client terminal, you will be prompted to write where the key will be located in the client.

The format of what will appear after running ssh-keygen is:

(/Users/User-name/.ssh/id_rsa): /Users/User-name/.ssh/id_rsa or (C:\Users*User-name*/.ssh/id_rsa): C:/Users/User-name/.ssh/id_rsa

where User-name will depend on the client computer.

Following this, you will prompted for a passphrase which is a different thing from the password used to connect to the remote computer.

After the key files are generated, use the following commands to copy the key files to the remote computer:

ssh [email protected]

Enter the password to the remote computer

mkdir .ssh

logout

scp /Users/User-name/.ssh/id_rsa.pub [email protected]:~/.ssh/authorized_keys

You should now be able to use ssh and scp without being prompted for your password.

NoKey

  1. Optimizing Remote Running

There are many ways to make using the terminal and connecting the remote computer:

Multiple commands can be used by separating them with a semicolon (;):

SCPandSSH

Following the ssh command, another command can be written to immediately run it without having to connect to the remote server and logout:

SCPandLS

The up and down arrow can also be used in the terminal to scroll through the previous commands used, and not have to retype them all the time.