Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to copy a log file from an Amazon EC2 instance to my local machine (Windows 7). I am using WinSCP438, which is able to connect to the remote (Amazon EC2) server instance. I am trying to access the instance as the "root" user in WinSCP using the method described here, but I am getting an error shown in the below image:

Error listing directory '/var/log/tomcat7'. /Command 'cd /var/log/tomcat7' failed with return code 1: Permission denied

Why I am getting this error, and how do I copy the file from remote server (Amazon EC2) to my local machine?

Update: Output of commands, as requested:

$ sudo ls -ld /var/log/tomcat7
drwxrwx--- 2 tomcat root   4096 Jul 4 12:01 /var/log/tomcat7
$ id
uid=222(ec2-user) gid=500(ec2-user) groups=500(ec2-user), 10(wheel)
share|improve this question

1 Answer 1

up vote 4 down vote accepted

Instead of trying to access the logs as root user, it may be simpler to change the permissions on the server to grant access to the ec2-user. This can usually be done with the commands chown and chmod, but the exact steps depend on the way your server is set up. If you need help to do that, you can post the output of the following commands and I'll try to help:

sudo ls -ld /var/log/tomcat7

Edit: Ok based on your output bellow, what you could do is change the group of the log directory to tomcat (instead of root) and then add the ec2-user to the tomcat group:

sudo chown -R tomcat:tomcat /var/log/tomcat7
sudo usermod -G ec2-user,wheel,tomcat ec2-user

Then you must log out and log back in for the new group membership to apply.

share|improve this answer
sudo ls -ld /var/log/tomcat7 -> drwxrwx--- 2 tomcat root 4096 Jul 4 12:01 /var/log/tomcat7 id -> uid=222(ec2-user) gid=500(ec2-user) gropus=500(ec2-user), 10(wheel) – Gaurav Agarwal Jul 4 '12 at 17:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.