Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to the whole virtual linux world. And this particular problem is strange and after a day of googling I find myself again on serverfault so thanks for your time!

I created a linux ec2 instance via amazon. I was able to successfully connect to the instance with Filezilla and Putty before entering any CLI.

What I was trying to do:

My only login was ec2-user and I wanted access to the /var/www/html which is owned by user root.

So I connected via Putty and typed the following

 sudo su-
 chown -R ec2-user /var
 chmod -R 755 /var

Then I disconnected.

Now Putty and Filezilla will refuse my connection and throw errors when I try.

What went wrong?

share|improve this question
up vote 3 down vote accepted

The /var directory holds files that are used by various programs which require strict file permissions. If the permissions have been changed, the programs will return an error and fail to run.

By modifying the permissions of this directory, you have most likely rendered the system useless. At this point you may want to remove the EC2 instance and fire up a new one.

Be wary of recursively changing permissions and ownerships on Linux filesystems.

The best practice to work within files owned by root is to use the 'sudo' command to edit individual files, or if working for an extended period of time managing files owned by the 'root' user, "sudo su -" as you did, and make the changed necessary as the root user.

share|improve this answer
so if I would have done /var/www/html instead of /var it would be ok? – javasocute Mar 8 '12 at 14:50
"OK", yes. But also slightly ugly. The /var/www/html directory needs to be readable by the webserver user (which varies by distro). It's best to leave the permissions as they are until you're more comfortable with your understanding of Linux file permissions and to just edit using sudo. – NcA Mar 8 '12 at 14:56
Thanks for the answers man. – javasocute Mar 8 '12 at 20: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.