Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: gedit changes owner and group of file

  1. #1
    Join Date
    Dec 2005
    Beans
    134

    gedit changes owner and group of file

    Does anybody know how to force gedit to retain the original owner and group of a file when saving it?

    I have several files on my web server that need to be readable by the apache user (www-data) but also editable by web author users. I don't want them world-readable, however, as it's a security risk for the contents of those particular files, so they are owned by www-data, and are assigned to the 'admin' group (of which I'm a member), with -rw-rw---- permissions.

    However: every time I use gedit to modify them, they wind up back with me as the owner and the group assigned to my user group! (Fortunately the permissions stay the same.) It's very irritating to have to go in and manually change the permissions back every single time I make a modification. I wasn't able to find any help on Google.

    Any thoughts?

  2. #2
    Join Date
    Apr 2007
    Beans
    2,951
    Distro
    Ubuntu

    Re: gedit changes owner and group of file

    This was an issue with gedit in early Gutsy that was solved. See our discussion of almost a year ago, http://ubuntuforums.org/showthread.p...it+permissions

    For me, it currently works correctly.

  3. #3
    Join Date
    Dec 2005
    Beans
    134

    Re: gedit changes owner and group of file

    Strange. I am running Hardy (and have been since its release).

    Do you know what version of gedit fixed it?

  4. #4
    Join Date
    Dec 2005
    Beans
    134

    Re: gedit changes owner and group of file

    Addendum:

    Perhaps this is the difference. I usually use gedit to edit files over ssh (that is, I edit files like sftp://user@host/var/www/....). I did your little test, and it seems to maintain users and permissions fine locally on my machine, but on the remote host it messes things up.

    Is this a new version of that bug, then?

  5. #5
    Join Date
    Apr 2007
    Beans
    2,951
    Distro
    Ubuntu

    Re: gedit changes owner and group of file

    I have notified the gnome developpers: http://bugzilla.gnome.org/process_bug.cgi
    This is a similar ill behaviour that persists for remote files. nano does not have this issue.

  6. #6
    Join Date
    Apr 2006
    Beans
    11

    Re: gedit changes owner and group of file

    bump

    It's 2011 and gedit is changing the group from www-data to my userid group every time I save a file, and I have to ssh in with a terminal and change it back - very annoying and time consuming! I've googled my face off and can find no solution. Anyone know what is causing this or better still, know some way of fixing it?

  7. #7
    Join Date
    Jun 2005
    Location
    Germany, Thüringen
    Beans
    71

    Re: gedit changes owner and group of file

    have the same problem.
    Really anoying.
    [urlmichaelstein-itb.de[/url] - TYPO3 development

  8. #8
    Join Date
    Apr 2006
    Beans
    11

    Re: gedit changes owner and group of file

    Bump again for 2012!

    I'll be bumping this every year- it's a high priority bug if you maintain code on a server and do it all the way that's prescribed to "just work" in Ubuntu 10.04 LTS... with ssh via Nautilus' GUI file browser and gedit. The LTS isn't meant to be bleeding edge. The editor has no business changing the group owner of a file, it's potentially a security issue, so why does it do it and how can I stop it? Anyone? Is there a similar editor to gedit that doesn't mess with the group of the file? How could I notify the gedit developers about this? This isn't my area of expertise.

  9. #9
    Join Date
    Feb 2008
    Location
    Texas
    Beans
    29,647
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: gedit changes owner and group of file

    Hi, how are you running gedit with sudo? if so you need to run all graphical applications with gksu or gksudo to make sure root does not take ownership and if this is the case it is not a bug, here is a link.
    https://help.ubuntu.com/community/RootSudo
    Thanks

  10. #10
    Join Date
    Dec 2005
    Beans
    134

    Re: gedit changes owner and group of file

    Hi,

    The problem this thread is discussing actually has nothing to do with sudo (or the root user at all for that matter). The canonical situation is one like the following:

    File 'FILE' exists on machine MACHINE1 with owner USER1, group GROUP, and permissions rw-rw-r--:

    Code:
     $ ls -l FILE
    
     -rw-rw-r-- 1 USER1 GROUP 12345 2012-01-01 00:00 FILE
    User USER2, who is a member of GROUP, edits FILE over SFTP using gedit (since the file is group-writable).

    After editing, the file owner changes!:

    Code:
    $ ls -l FILE
    
     -rw-rw-r-- 1 USER2 GROUP 12345 2012-01-01 01:23 FILE
    The use case in which I encounter it is when I am editing code for a web server, which is owned by user "www-data" and group-writable by "web-admin". It should remain owned by www-data after editing, but it changes to my personal user (who is a member of www-data). This shouldn't happen!

    Hope this clarifies the issue.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •