Saltar al contenido

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?

preguntada hace un año170 visualizaciones
2 Respuestas
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

respondido hace un año
EXPERTO
revisado hace un año
EXPERTO
revisado hace un año
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.

EXPERTO
respondido hace un año
  • 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
    

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.