Question

How to download my code

Posted December 24, 2021 127 views
DigitalOcean

Hi – we have been abandoned by our developer and are stuck with digitalocean which is clearly an environment for techies – we’re not AT ALL. We want to access and download our code and have spent a couple of hours going round in circles trying to figure out things like SSH Keys and setting up consoles. At each step we hit a brick wall where an instruction requires technical knowledge and may as well have been in written in Klingon.
Is there anyone out there who tells us how to access the code on our droplet? We have apple macs and we have filezilla installed. We’re super familiar with accessing servers via SFTP using and FTP client and the regular hostname / un / pwrd route but digitalocean is a whole new world full of wonder and bafflement!
Please help.
Thanks
Martin

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hello, @martinrDolphin

What I can recommend is to access the droplet via sFTP using a client like FileZilla and download the source code of your site/application.

If you have access to your account then you can easily connect to your droplet. You can also use the root username to connect and if you do not remember or have the password you can also reset it.

You can check the following articles in order to connect via sFTP.

https://docs.digitalocean.com/products/droplets/how-to/transfer-files/

https://www.digitalocean.com/community/tutorials/how-to-use-filezilla-to-transfer-and-manage-files-securely-on-your-vps

Regards,
Alex

by Pablo Carranza
This article will teach you how to use Filezilla to transfer and manage files securely on your VPS.
  • Hi Alex

    I’ve been away and only just picked up your reply – thanks for coming back to me.
    Unfortunately all that you’ve done is to send us a link to articles that we have already read and don’t make any sense to us! We have been unable to successfully create and add ssh keys and so cannot connect via sFTP. My original question was, is there anyway we can connect to our code using the traditional hostname, username and password without having to set keys?
    It’s super frustrating to have a bunch of code on digital ocean which is buried behind a mass of technology which is meaningless to us!
    Thanks
    Martin

    • Hello, @martinrDolphin

      If the PasswordAuthentication is enabled on the droplet you can ssh to the droplet with a username and password to download the code.

      However, if PasswordAuthentication is disabled you’ll need to enable it first using the DigitalOcean console. A process that is covered here:

      https://www.digitalocean.com/community/questions/how-to-enable-password-authentication-on-server-digital-ocean

      https://docs.digitalocean.com/products/droplets/resources/lost-ssh-key

      Hope that this helps!
      Regards,
      Alex

      • Hi Alex

        I ran that command in terminal – it appears that passwordauthentication is on:

        To disable tunneled clear text passwords, change to no here!

        PasswordAuthentication yes

        PermitEmptyPasswords no

        Trouble is, we don’t know the password! I entered ‘how to change the password’ into the support area and the only response was 'how to switch from password authentication to ssh’.

        Just to save time – one of the frustrations we have is that it appears that we might be able to change the password using something called 'console’ - however, to enable console we need to log in. Of course, if we could login our problem would be solved!!

        Any further ideas?

        Thanks
        Martin

        • Hello, @martinrDolphin

          If you’re unable to access your droplet you can try to reset the root password and then check your email and access the droplet via the web console.

          You can reset your root password for your account. Navigate to the control panel. From the project, the Droplet is in, or from the main navigation’s Droplets page, locate the Droplet. Click the Droplet’s name to open its detail page, then select Access in the left navigation.

          Click Reset Root Password to reset the Droplet’s password. You will receive an email containing the Droplet’s temporary password.

          Note: Some operating systems use internally-managed passwords, which means you cannot reset the root password from the control panel. In these cases, you’ll see the following message in the Reset root password section:

          Once you have received your new password you can either ssh to the droplet using your ssh client or access the droplet using the DigitalOcean console:

          https://www.digitalocean.com/docs/droplets/resources/console/

          Log In with the Console

          From the DigitalOcean Control Panel, first click the name of the Droplet you want to access, then select Access from the left navigation. Click the Launch Console button to open a web-based console session.

          When the console opens, click the console screen and press ENTER to ensure that the login prompt has focused. At the login prompt, enter the user you want to log in as. This is typically the root user or a user-configured with sudo privileges.

          When prompted, enter the password associated with the account. For security purposes, your password will not be displayed on the screen as you type or paste it into the command line.

          Once you’ve entered the password, press ENTER. If this is the first time you’ve logged in after resetting the root password through the control panel, you are prompted to enter the password again, then asked to choose a new password.

          Once you’ve successfully entered your credentials you should be logged in to your Droplet.

          Hope that helps!
          Regards,
          Alex

          • Hi Alex - thank you for your reply and thank you for your patience. I know I’m being super stupid here but I’m not making ANY headway.

            I decided to reset the root password as you suggested. It sent me an email which is good

            There is absolutely no way I can successfully login using SSH. I created the keys and believe I have added the pub key to my droplet (but it’s only a guess). I then meticulously followed the instructions for filezilla but get this message every time:

            12:29:07 Status: Connecting to 178.62.103.207…
            12:29:19 Status: Using username “root”.
            12:29:19 Status: Server refused our key
            12:29:19 Error: FATAL ERROR: No supported authentication methods available (server sent: publickey)
            12:29:19 Error: Could not connect to server
            12:29:19 Status: Waiting to retry…
            12:29:24 Status: Connecting to 178.62.103.207…
            12:29:24 Response: fzSftp started, protocol_version=11
            12:29:24 Command: keyfile “/Users/redacted/Desktop/ssh/tands.ppk”
            12:29:24 Command: open “root@178.62.103.207” 22
            12:29:25 Command: Trust new Hostkey: Once
            12:29:25 Status: Using username “root”.
            12:29:25 Status: Server refused our key
            12:29:25 Error: FATAL ERROR: No supported authentication methods available (server sent: publickey)
            12:29:25 Error: Could not connect to server

            So I decided to go the console route; there is no ‘launch console’ button anywhere.So I clicked 'console’ to the top right of my account page. It then says that to launch console I need to login as root. This is what I mentioned in the last post. If I could login as root my problem is solved!! But I can’t. So I need to launch console. But I can’t because i need to login as root … you get my frustration?

            So I tried recovery console. This launched a new browser window which prompted me for a login. I used root and the temp password and I got to a screen which tells me that my webroot is located at var/www/html. Seems to be a MASSIVE piece missing here - what comes BEFORE var/www/html? Thrashing around in the dark I tried the IP address – result 'nothing here’.
            There were two other urls - one led me to the front end of our website (thanks – I know how to do that) and the other to a pointless guide on how to configure your DO server – thanks but I don’t need to do that either.

            But STILL no access to the code!!!!

            Are you sensing deepening frustration here?

            Martin

Hello, @martinrDolphin

The error means that FileZilla tried all available authentication methods and have not succeeded. In your case, there was only public key authentication method available.

Here, you have two options, one would be to enable password authentication and the other would be to add your ssh key to your FileZilla application.

When logged into the recovery console you can enable the ‘PasswordAuthentication` in order to access the droplet via ssh client or FileZilla using a password instead of the key.

You can enable PasswordAuthentication for your Droplet by modifying your /etc/ssh/sshd_config file. Once set to Yes restart the SSH service and connect via an SSH client for a more stable connection. You can then modify your ~/.ssh/authorized_keys file to add the appropriate public key.

To enable the PasswordAuthentication follow these steps:

  1. Login to the console on the DigitalOcean website.
  2. Type sudo nano /etc/ssh/sshd_config
  3. Change PasswordAuthentication from “no” to “yes” and save the file
  4. Open a terminal on your computer and type ssh username@[hostname or IP address] or if on a Windows box use PuTTY for password login making sure authentication parameters aren’t pointing to a private key
  5. Login with a password
  6. Type sudo nano ~/.ssh/authorized_keys
  7. Paste public key text here and save the file
  8. Type sudo nano /etc/ssh/sshd_config
  9. Change PasswordAuthentication from “yes” to “no” and save the file
  10. Log out and attempt to log back in (if using PuTTY make sure you set up auth parameters to point to your private key)

You can then upload the key using this command:

  • ssh-copy-id -i ~/.ssh/YourKey user@droplet

Note that you need to enter the path to your actual ssh key.

Hope that this helps!
Regards,
Alex

  • Hi Alex

    I’m sorry – this is IMPOSSIBLE.

    There’s SO much I don’t understand here – I am trying as best I can but it really is hopeless if you don’t know what you’re doing!

    trust me, each time you send a reply I try to follow the instruction for an hour but hit brick wall after brick wall. I just get ‘permission denied’ or 'error’.

    I’m at my wits end – all I want is my freaking code that some idiot developer who has now disappeared off the face of the earth put on DO. This is an environment for IT specialists only. I’m not!

    Is there anyone at digital ocean who can talk me through this by some kind of free app?

    You’ve been SO patient but I’m really just wasting your time.

    It’s just insane that DO have my code and I can’t download.

    Martin