How do I connect to my ec2 instance using Cyberduck with privileges?

I am trying to login using ec2 user but login fails for some reason:

Using username: ubuntu, I can log in just fine, however I don't have any privileges and I can't suudo su for the privileges to write to my files. I tried to use cyberduck terminal and send command parameters but sudo su doesn't work with them. Cyberduck just spins.

+3


source to share


1 answer


I don't think the account ec2-user

works with recent Ubuntu AMIs, which might explain the failed login.

You can approach this in several ways. First, create a new user account specifically for FTP and grant it permissions only on the folders you need. First create a user , then create a public / private key pair for the non-interactive login. This will allow you to manage your FTP client as usual.

My preferred solution is to download the files to your home directory ubuntu

and then run the script as root, which moves the files to the correct location. You do not have to change the system configuration in this way, but you do have to complete the file transfer in two steps.

Create an intermediate folder in /home/ubuntu

and copy the files there. Create a /home/ubuntu/copy.sh

script on the server like this:



#!/bin/bash
sudo su     #this will only work if sudo doesn't prompt for a password
cp -r /home/ubuntu/stage/* /var/www/html/

      

Then, from your development computer, call the script:

$ ssh -i ~/path/to/key.pem ubuntu@ec2.hostname.com /home/ubuntu/copy.sh

      

If you want to get really fancy, you can create a git repository and use a post-receive hook to handle this all for you when you push. No FTP client required.

0


source







All Articles