Thid bolg is going to guild you how to access UCSD server via terminal in VSCODE.
First thing is to install VSCODE
Clik that blue buttom to download.
After you install, open it and you should see a page like this: clike the “terminal” on the tool bar and then you can access the terminal like this: then, you can input the command line code in the terminal.
Now, you may need to install openSSH for remote connecting: After openSSH setup, you can try the command:
# $ssh cs15lsp22zz@ieng6.ucsd.edu
where zz should replace by your course specfic account. type in your password and you will recieve a message aking you confirm, type “yes” and press Enter.
This pitcrue indicate you have successfully login to the server.
you can try some command right now: ls, cd, ls-a. If you want to log out, type in “exit” or press Ctrl-D
Next you can try to move file to the sever from your computer: Using ‘cd’ or ‘cd’ goes into the directory of the file that you want to move.
# $scp WhereAmI.java cs15lsp22zz@ieng6.ucsd.edu:~/
Using scp to move file to server like the pitcure did, scp fllows by the file name fllows by the account. After that, login to the server and run ‘ls’, you should see the file you just moved in.
If you feel boring about inputing the password every time when you login, you can setup a SSH keys:
#
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/<user-name>/.ssh/id_rsa): /Users/<user-name>/.ssh/id_rsa
Enter passphrase (empty for no passphrase):
enter the file directory fllows by the code above. And then it will ask you entering passprhase. clik enter if you don’t need. Then it will show you your key fingerprint and the key’s randomeart image. If you are in Windows, you may need to run these few linesin PowerShell in order to make the key works:
'Get-Service ssh-agent | Set-Service -StartupType Manual'
After it finish, it should display like the following image:
next: you need to copy the punlic key to the .ssh directory which is the .pub file that just been create.
$ scp /Users/<user-name>/.ssh/id_rsa.pub cs15lsp22zz@ieng6.ucsd.edu:~/.ssh/authorized_keys
using the path you saw above.
Futheremore, if you want some more convinience, you can run file or commands in your computer without login to server.
$ ssh cs15lsp22zz@ieng6.ucsd.edu "ls"
quote the commands you want to run at the end of the ssh sentence. this will let you run the command in the server but without login. It save a lot of keystrokes since you don’t need to type in your password right now, and you don’t need to exit after that command ran.