Skip to content

Instantly share code, notes, and snippets.

@dazeb
Created January 20, 2024 00:24
Show Gist options
  • Select an option

  • Save dazeb/8af5bf6f02934aa1b57ca1d63afa9c6a to your computer and use it in GitHub Desktop.

Select an option

Save dazeb/8af5bf6f02934aa1b57ca1d63afa9c6a to your computer and use it in GitHub Desktop.

Yes, you can upload and test the script from VS Code on your Proxmox server using a few different methods. Here's a step-by-step guide on how to do it:

Method 1: Using SCP (Secure Copy Protocol)

  1. Open a terminal in VS Code: You can open an integrated terminal in VS Code by pressing Ctrl+` (backtick) or by selecting "Terminal" > "New Terminal" from the top menu.

  2. Use SCP to upload the script: In the terminal, use the scp command to securely copy the script to your Proxmox server. Replace <script-name>.sh with the name of your script file.

    scp <script-name>.sh root@192.168.0.10:/path/to/destination

    For example, if your script is named tomato.sh and you want to upload it to the /root directory on the Proxmox server, the command would be:

    scp tomato.sh root@192.168.0.10:/root

    You will be prompted to enter the root password for your Proxmox server.

  3. SSH into your Proxmox server: After uploading the script, you can SSH into your Proxmox server to execute it.

    ssh root@192.168.0.10
  4. Make the script executable: Once logged in, navigate to the directory where you uploaded the script and make it executable.

    chmod +x /root/tomato.sh
  5. Run the script: Execute the script.

    /root/tomato.sh

Method 2: Using VS Code's Remote - SSH Extension

  1. Install the Remote - SSH extension: In VS Code, go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window. Search for "Remote - SSH" and install it.

  2. Connect to your Proxmox server: Click on the green bottom-left corner of VS Code or press F1 and type "Remote-SSH: Connect to Host..." then press Enter. Add a new SSH host with the following format:

    ssh root@192.168.0.10

    Follow the prompts to enter your root password and connect to the server.

  3. Open the script on the remote server: Once connected, you can open the script directly from the remote server, make changes, and save them.

  4. Open a terminal in the remote session: Open a new terminal in VS Code, which will now be connected to your Proxmox server.

  5. Make the script executable and run it: Use the same commands as in the previous method to make the script executable and run it.

    chmod +x /path/to/tomato.sh
    /path/to/tomato.sh

Using either of these methods, you can upload and test your script on your Proxmox server directly from VS Code. Remember to replace /path/to/destination and /path/to/tomato.sh with the actual path where you want to store and execute the script on your Proxmox server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment