septerr
septerr

Reputation: 6603

Linux Group Permissions

I have set up an ec2 machine to run an app. To make my deployment script work, I need my deployment user (ec2-user) to have write access to certain directories. I am not versed in linux/unix commands. I am finding my way around using Google.

So the directory in question is /home/ec2-user/uc_social_server/releases. The directory was created by a Capistrano script and for whatever reason it made root the owner of the releases directory even though the script was being run as the ec2-user. An ls -l shows that the root is the owner and that both the owner and group have rwx access: enter image description here

My script is failing because it is trying to write to the releases directory as ec2-user but does not have the permission.

I figured if I create a group called deployers and added both root and ec2-user to this group, ec2-user will then have rwx permissions to this directory since ec2-user will belong to same group as root and the group permissions to this directory are rwx. But that did not work.

Should that have worked? If not why (my understanding of the group permission may be totally wrong)?

How can I give ec2-user rwx access to this director?

Thanks.

Upvotes: 0

Views: 909

Answers (2)

Alexej Magura
Alexej Magura

Reputation: 5129

run:

sudo chown -R ec2-user releases ; sudo chgrp -R ec2-user releases

or if you want to leave the owner and group as root then you can try running this:

sudo chmod -R o=rwx releases 

Read the fine manual for more information on chmod, chgrp, and chown.

Upvotes: 2

JVXR
JVXR

Reputation: 1322

Unix Rule #1) Don't use root in vain

I'd recommend that you just sudo to root and change the owner and group of the directory to what you want it to be

  • man chown
  • man chgrp

Upvotes: 1

Related Questions