For any given file in the web root, the permissions are initially set to me:www-data with chmod 750. Opening a file in an editor and saving via the editors save command changes the group to me:me. How do I prevent group changes on save?

  • @WarrenHill: this is a completely different question...
    – Nick
    Apr 24, 2014 at 13:03

2 Answers 2


Linux saves the file using your active group, so change your active group before you edit.

Easiest method is to change your primary group.

You can do this temporarily with newgrp , this command starts a new shell

newgrp www-data
gedit your_file

If you want to change your primary group permanently, use usermod

usermod -g www-data your_user 

This seems to be a bug (LP #199167).

You could try to open your editor as www-data using gksudo -u www-data gedit.

  • It may be related to that bug... but that's a really old bug! Opening as www-data wouldn't help because www-data should not have write permissions to the files for security reasons.
    – Nick
    Apr 24, 2014 at 13:09

Not the answer you're looking for? Browse other questions tagged .