Owner changed after saving file

Bug #199167 reported by nclm on 2008-03-06
70
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Geany
Unknown
Unknown
gedit
Confirmed
Medium
geany (Ubuntu)
Undecided
Unassigned
gedit (Ubuntu)
Low
Ubuntu Desktop Bugs

Bug Description

Binary package hint: gvfs

I've edited a text file with gedit via sftp. After saving it, the owner user and group is changed to the user that logged on the ssh server. This should not happen.

Sebastien Bacher (seb128) wrote :

Thank you for your bug report. What version of Ubuntu do you use and how do you access the sftp location? gedit has not been ported to use gvfs in hardy so it's clear clear the bug is there

Changed in gvfs:
assignee: nobody → desktop-bugs
importance: Undecided → Low
status: New → Incomplete
nclm (nclm) wrote :

I'm using the current development branch (gvfs: 0.1.11svn20080307-0ubuntu1). I've accesed the sftp location with nautilus. I'll try it again after gedit is ported to gvfs...

Sebastien Bacher (seb128) wrote :

could you describe the steps you use to trigger the issue?

nclm (nclm) wrote :

1. Nautilus -> ctrl+L -> ssh://<email address hidden>
2. Right click some text file or drag it into gedit, that has an other owner than root
3. edit and save it
4. check the file permissions (i did that in a terminal - btw I just saw that it's not possible to change the file permissions in the "file properties" dialog)

Sebastien Bacher (seb128) wrote :

not confirming, gedit refuses to store the changes when trying, could you describe easy steps to trigger the bug?

nclm (nclm) wrote :

For me this is still working....

On the server I've created a simple text file with vim and chowned to chr:chr:

-rw-r--r-- 1 chr chr 6 Mar 25 08:29 test.txt

Then I logged in with nautilus: Nautilus -> ctrl+L -> ssh://<email address hidden>
right clicked "Open with text editor", added some new text and saved. The result is:

-rw-r--r-- 1 root root 9 Mar 25 08:34 test.txt

Changed in gedit:
status: Incomplete → New
Pedro Villavicencio (pedro) wrote :

May someone else confirm this bug? thanks.

Confirming this bug:
Created a file on the server as user1, then opened the file via nautilus/ssh and gedit as user2. After saving the file, the file belonged to user2. In this scenario, the group was not changed - but when I used root as user2 (like the OP) both user and group were changed to root.

Changed in gedit:
status: New → Confirmed

Another thing regarding Sebastien's comment: I get an "not sufficient permissions" error messages when trying to save the file as user2 if the _directory_ containing the file is not writeable for user2. It seems that gedit tries to create a new file that then has the logged in user as its owner.
It's maybe still the same issue as http://bugzilla.gnome.org/show_bug.cgi?id=360400 - gedit is not yet using gvfs, right? Maybe the problem will persist until then...

Changed in gedit:
status: Confirmed → Triaged
Changed in gedit:
status: Unknown → Confirmed
KaOS-bEat (kasper-jordaens) wrote :

so about 18 months later this bug still hasn't been fixed? This could lead to serious trouble if you are editing config files on a server through gedit like I was doing. Files can become unreadable to some programs.

steps to reproduce in 9.10:

1. open ssh connection in nautilus
2. open text file with other owner then current logged in user (but group write perms) in gedit
3. save.

I couldn't find another text editor that understood the gnome sftp URI, so it might be a nautilus/gvfs problem

regards

KaOS-bEat (kasper-jordaens) wrote :

forgot to mention i'm on 9.10

eXlin (hirvonen-henri) wrote :

I have same issue (my groupmates are getting their nerves ripped) with 9.10 and 10.04 alpha 3.

I open file trough ssh (Connect to server...) with permissions like owner.team 775 (server is ubuntu 8.04) and i open file for edit to gedit. After i save it permissions has changed to nick.nick.

Christopher Blay (blayde) wrote :

i am having this problem as well. this almost sounds like a papercut to me... unfortunately it's probably too late to get this fixed in time for lucid?

in the mean time (a few more years?) users could try using sshfs to mount remote files but that isn't always a good solution

Changed in gedit:
importance: Unknown → Medium
vindex (niklas-correnz) wrote :

this also affects Kate 3.5.1 on Ubuntu 10.10 saving files via sftp on a Ubuntu 10.04 server

Paolo Benvenuto (donpaolo) wrote :

Also affects geany.

Marcusklaas (marcusdevries) wrote :

I can confirm this bug is still present on Ubuntu 11.04. I have maximum updates. Please fix within next decade.

Changed in geany (Ubuntu):
status: New → Triaged
Lilleman (lilleman) wrote :

Running Ubuntu Desktop LTS 64bit, fully patched and I can confirm this issue. It is a pain. Please, please fix!

Scott Deagan (scott-deagan) wrote :

I am running Ubuntu 11.10 desktop 64 bit, the server is 11.10 64 bit, all updates installed, and this problem still exists. Steps to reproduce:

1. Create a file on the server (eg: /tmp/test.txt).
2. chown usr1:grp1 /tmp/test.txt
3. Open Nautilus on desktop.
4. Press CTRL+L (address bar appears).
5. Enter sftp://server.ip.address/tmp/
6. Double click test.txt to open it with gEdit.
7. Enter some text.
8. Save the file.

The result is the group is not preserved, and will change to user1:[user1's group].

I performed the same test on Windows using WinSCP 4.x, and the result is the group permissions are preserved (<-- expected behaviour).

Please fix this as many of us consider this to be a very useful feature (dare I say a 'killer feature' in Linux).

guncharly (guncharly) wrote :

Still the same bug on 12.04.
It is very critical.

Damion Dooley (damion-n) wrote :

Same bug, 12.04 . FYI, same problem existed with jEdit, but only when its "Save-twice" option was set. It would upload file to a temporary name, and once complete, then replace remote server's file with temporary upload. Perhaps the temp file had both owner and group set to ssh login. When instead save-twice feature disabled, original file's owner and group are preserved.

Will Rouesnel (w-rouesnel) wrote :

Confirmed for 13.04 as well.

When logged into an SFTP share as root, if I edit a file by another user and hit save the file's permissions get reset to root:root.

This is a very big problem editing web-pages or configuration files which might been specific ownerships and not be world-readable since they then can't be loaded.

problem still exists:
using ubuntu 12.04 and gftp: editing a .htm file with initially rights 644 , editing > then saving locally > actualize the directory > transfering the file to server > rights "automatically" changed to 600, so i have to manually re-change every time to 644 !
gedit: obsolete > now i like using leaftab.

Problem still exists 14.04 LTS over SSHFS

Problem is still present in 17.10. It's almost certainly a GVFS issue, since I'm seeing it with multiple editors (when editing files in a directory mounted over SSH in Nautilus). Editors tested include: Gedit, Atom, VSCode.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.