Skip to the content.

Lab Report 1 Week 2

April 10th, 2022. Tianyang Xu.

This lab report includes the following sections:


Installing VS Code

Image

  1. To install Visual Studio Code, first visit the webiste.

  2. Click the blue download button to download VSCode. Since I am using a MacBook, I downloaded the Mac Univseral version.

  3. Once downloaded from the website, follow the instruction and finish intalling on the computer.


Remotely Connecting

  1. To remotely connect with the server computer, I first found my username from this website.

  2. Then, I typed ssh cs15lsp22<username>@ieng6.ucsd.edu and entered password, which successfully connected my terminal with the server computer as shown below. Image Image


Trying Some Commands


Moving Files with scp

  1. To copy a file from client to server, I created a new java file called WhereAmI.java which contains following codes:
    class WhereAmI {
     public static void main(String[] args) {
       System.out.println(System.getProperty("os.name"));
       System.out.println(System.getProperty("user.name"));
       System.out.println(System.getProperty("user.home"));
       System.out.println(System.getProperty("user.dir"));
     }
      }
    
  2. Then, I compiled and ran the program on my computer, it returned information about my computer. Image

  3. I copied the file from my computer to the server using scp WhereAmI.java cs15lsp22zz@ieng6.ucsd.edu:~/ command. To verify, I connected with server, entered ls command, and found the WhereAmI.java file. Image

  4. I compiled the file, ran it on the server, and got information about the server computer as expected. Image

Setting an SSH Key

  1. To do so, I first generated a ssh-key on the client and the save the public key in my computer. Image

  2. I logged into server, created a new directory called .ssh, and logged out from the server. Image

  3. I copied the public key from client to the directory .ssh that I just created in server. Now, when I try to connect with the server, I will be no longer asked to enter passwords. Image


Optimizing Remote Running

  1. I can remotely list all the files in server by entering ‘ssh cs15lspzz@ieng6.ucsd.edu "ls". Image

  2. Remember the WhereAmI.java I created in the previous section. I can remotely compile and run the WhereAmI file by simply entering ssh cs15lsp22axa@ieng6.ucsd.edu "javac WhereAmI.java; java WhereAmI". Image


Back to main page