내용으로 건너뛰기

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?

질문됨 일 년 전170회 조회
2개 답변
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

답변함 일 년 전
전문가
검토됨 일 년 전
전문가
검토됨 일 년 전
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.

전문가
답변함 일 년 전
  • 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
    

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠