Skip to content

RE:copy files from ec2

0

hi. i can ssh to ec2 using putty, but unable to copy files, permission denied. if i use sudo su then only can view file, but use winscp cannot. any way?

asked a year ago163 views
2 Answers
1

Hello,

When you log in using a user, you can access only directories or files that are owned by or have access to that user. If you try to access any other folder like root "/", you will get a permission denied error. So if you want to access a folder, ensure that the folder already has access for the user you are trying to log in with.

[+] https://stackoverflow.com/questions/28261503/get-permission-to-work-with-files-on-my-amazon-ec2-ubuntu-server-using-ftp-winsc

answered a year ago
EXPERT
reviewed a year ago
EXPERT
reviewed a year ago
0

Hello. You can download the file by copying it to a location accessible to the user who logged in then changing the permissions with the chmod command.

EXPERT
answered a year ago
  • hi how to do that?

  • how to do that specifically?

  • Suppose you are logged in as an ec2-user and want to download /var/log/nginx/access.log. You can download the file in /home/ec2-user/access.log by typing the following command.

    sudo su -
    cp /var/log/nginx/access.log /home/ec2-user/access.log
    chmod 755 /home/ec2-user/access.log
    

    Or you can use chown to change the owner.

    sudo su -
    cp /var/log/nginx/access.log /home/ec2-user/access.log
    chown ec2-user: /home/ec2-user/access.log
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.