I can upload a single file to the AWS EC2 linux server, but not able to upload a directory. I keep getting Permission denied error. The ssss folder is under kolgate-playground, I think my path is correct because I can upload a untitled.txt under kolgate-playground folder
ray#Roxane kolgate-playground % scp -r "ray.pem" ssss ec2-user#ec2-18-191-59-50.us-east-2.compute.amazonaws.com:new
ec2-user#ec2-18-191-59-50.us-east-2.compute.amazonaws.com: Permission denied (publickey).
lost connection
The command should be (note the use of -i and -r):
scp -i "ray.pem" -r ssss ec2-user#ec2-18-191-59-50.us-east-2.compute.amazonaws.com:new
Related
I am trying to copy a filled folder from my local machine to AWS server.
So, I used the following command, but was not working:
scp -r IPADTEST.pem oafolder ec2-user#__________.compute.amazonaws.com:testfolder
The error was:
ec2-user#_________.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
lost connection
I am sure the IPADTEST.pem is working okay, because I can SSH from the same location:
$ ssh -i IPADTEST.pem ec2-user#_____________.compute.amazonaws.com
Also, I can copy a file (not folder), for example I can copy index.html:
sudo scp -i IPADTEST.pem index.html ec2-user#______________.compute.amazonaws.com:testfolder/
You absolutely need "-i .pem".
Q: Have you tried scp -r -i IPADTEST.pem oafolder ec2-user#__________.compute.amazonaws.com:testfolder?
I am trying to get scp to work and transfer a file from a remote server to my local. I tried looking around and this post helped the most but it still is not working here is the current output.
<HOSTNAME>:chef4-rep
<USERNAME>$ sudo scp -i ./.chef/<NAME>.pem <USERNAME>#<IP>:/home/postgres/post_0604_dump/db0604_schema_and_data.sql ~/
<USERNAME>#<IP>: Permission denied (publickey).
The issue turned out not to be with my command but that I was trying to copy a file in another users directory and it wouldn't work. I ended up SSH'ing in and using sudo to copy the file to my home directory and then used scp with no issues.
Kindly use below command to get it done.
root#localhost# scp -r "source_file/directory" "Destination address- remote-IP/Hostname:/location"
And if you are using passwordless ssh then make sure you are using correct user whose public keys are shared with remote server.
Thanks
I had the same issue with scp and got Permission denied (publickey):
This worked:
ssh -i "mykey.pem" ubuntu#??.??.??.???
But this didn't: scp -i "mykey.pem" test.php ubuntu#??.??.??.???:
I solved it by removing the quotes off my key file:
scp -i mykey.pem test.php ubuntu#??.??.??.???:
I am trying to transfer files to my Google cloud hosted Linux (Debian) instance via secure copy (scp). I did exactly what the documentation told to connect from a local machine to the instance. https://cloud.google.com/compute/docs/instances/connecting-to-instance.
Created a SSH keygen
Added the keygen to my instance
I can login successfully by:
ssh -i ~/.ssh/my-keygen [USERNAME]#[IP]
But when I want to copy files to the instance I get a message "permission denied".
scp -r -i ~/.ssh/my-keygen /path/to/directory/ [USERNAME]#[IP]:/var/www/html/
It looks like the user with which I login has no permissions to write files, so I already tried to change the file permissions of /var/www/, but this still gives the permission denied message.
I also tried to add the user to the root group, but this still gives the same problem.
usermod -G root myuser
The command line should be
scp -r -i ~/.ssh/my-keygen /path/to/directory/ [USERNAME]#[IP]:/var/www/html/
Assuming your files are in the local /path/to/directory/ and the /var/www/html/ is on the remote server.
The permissions does not allow to write in the /var/www/html/. Writing to /tmp/ should work. Then you can copy the files with sudo to the desired destination with root privileges.
If SSH isn't working, install gcloud CLI and run the following locally: gcloud compute scp --recurse /path/to/directory [IP] --tunnel-through-iap. This will dump the directory into your /home/[USERNAME]/ folder. Then log into the console and use sudo to move the directory to /var/www/html/.
For documentation, see https://cloud.google.com/sdk/gcloud/reference/compute/scp.
I gonna backup some files from a local machine to a remote server trough rsync over ssh. Here is the command I used:
rsync -avh -e "ssh -p 3286" somelocal_folder/ me#x.x.x.x:/data/bu/
The user(me) which I use to ssh to the server has rwx permissions on /data/bu directory but it does not have write permission on /data. It raises permission denied error when I enter my password. I searched a lot in the Internet,but I could not find any thing relevant. Any idea of the cause of the problem?!!
I am using picloud which is a high performance cloud service run on top of amazon ec2. I am trying to copy files into a newly created "environment" in my account. I am however unable to use the scp command to copy files from my local machine into picloud env that I have created.
The usual way to SSH into the picloud env is as follows:
ssh -i picloud_rsa picloud#ec2-54-242-89-28.compute-1.amazonaws.com
But when I try to replace ssh with scp using the following format:
scp -r ~/path_to_the_directory -i picloud_rsa picloud#ec2-54-242-89-28.compute-1.amazonaws.com
I get the following error:
cp: -i: No such file or directory
cp: picloud#ec2-54-242-89-28.compute-1.amazonaws.com/picloud_rsa: Permission
And If I try the following:
scp -r ~/Desktop/AllFolders/GMU/Fall\ 2013/yelp_phoenix_academic_dataset_duplicated/ picloud_rsa picloud#ec2-54-242-89-28.compute-1.amazonaws.com
I get just the permission denied error:
cp: picloud#ec2-54-242-89-28.compute-1.amazonaws.com/picloud_rsa: Permission denied
I have absolutely no idea how to use scp in this case and would really appreciate any help.
Thanks in advance!
The query I used was:
scp -i picloud_rsa -r ~/my_path_to_directory picloud#ec2-54-242-89-28.compute-1.amazonaws.com:/home/picloud
The solution was to pass the -i flag along with the rsa file in the beginning right after the scp call.