I tried deleting files on my dekstop (highlight files, press delete) in /usr/share/nginx/www but I'm getting permission denied issues.

What I did was, add www-data and barsoom(current user) to a group:

sudo addgroup web
usermod -a -G web barsoom
usermod -a -G web www-data
chgrp -R web /usr/share/nginx/www

But why can't I still delete the files in /usr/share/nginx/www. I'm still getting Permission denied?

  1. You need to logout and log back in after changing group membership in order to obtain the new set of privileges. (Alternatively you can run sg (like su, switch user, but instead switch group) You can see what privileges you current have by running id.

  2. What are the permissions on those files? Even with the group set to web, the group may not have the necessary write permissions.

|improve this answer|||||

Usually things under /usr/share are owned by root and permissions are -rwxr-x-r-x. The leftmost 3 characters are permissions for the root, followed by the group, followed by everyone (so only root has write access). Did you ls -l to see the permissions? Changing the group owner won't change the permissions. You need chmod for that.

If you really want to delete those files, open a terminal and:

cd /usr/share/nginx
sudo rm -r www

The -r is for recursive so that everything in that directory including itself will be removed.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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