Passer au contenu

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?

demandé il y a un an169 vues
2 réponses
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

répondu il y a un an
EXPERT
vérifié il y a un an
EXPERT
vérifié il y a un an
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
répondu il y a un an
  • 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
    

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.