file permissions destroyed by vim/gvfs/fuse
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gvfs |
New
|
Undecided
|
Unassigned | ||
gvfs (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
This bug is a little difficult to explain, but I will do my best. I'm using Ubuntu Hardy Heron with no third party repositories. Every package is up to date as of this posting.
It goes like this. When I edit files with vim or gvim through gvfs/fuse/sftp the file permissions on the real remote file system get destroyed. Here is a procedure you can follow to duplicate this bug. The only non-default package you need installed is vim or gvim.
1 - Open a terminal and ssh to a remote machine.
2 - In this terminal create a text file on the remote machine, and set the permissions to 644.
3 - Go to the Places->Connect to Server... menu item, and create an SSH connection to the remote machine.
4 - Double click the new sftp folder icon that appears on the desktop to open nautilus.
5 - In nautilus browse to the directory containing the text file you just created.
6 - Use the command ls -l in the ssh terminal to verify the permissions of the file are still 644.
7 - In nautilus right-click on the text file, open it with "Text Editor" (gedit)
8 - Make a change to the file in gedit and save it.
9 - Use the ls -l command in the terminal to verify that the permissions of the file are still 644.
10 - Exit gedit.
11 - In nautilus right-click on the text file and select the option to open it with "GVim Text Editor"
12 - Make some changes to the file in GVim, and save those changes.
13 - Use the ls -l command in the terminal, and you will see that the permissions of the file are now 600, not 644.
Some interesting things to note about this bug.
If you open the text editors from the command line, instead of through nautilus, the same problem happens.
So opening gedit like this:
gedit ~/.gvfs/sftp\ on\ remote/
will not damage the permissions.
However, opening vim like this:
vim ~/.gvfs/sftp\ on\ remote/
will damage the permissions.
Also, I notice that if you do this
ls -l ~/.gfvs/sftp\ on\ remote/home/user/
the permissions of test.txt (and every other file) will appear to be 600 (700 for directories), regardless of the file permissions on the "real" remote file system. If you attempt to chmod any files, it will result in a chmod of the actual permissions on the remote file system, but it will not change the permissions of the file in the local ~/.gvfs directory.
This has led me to conclude that this bug is a combination of two things. First, using the chmod command on files through gvfs/fuse/sftp does not work in an expected fashion. Secondly, gvim and vim appear to be chmod-ing files when they write to those files.
I'm not sure this bug is an actual security risk. It seems it can only result in file permissions becoming more strict, not more permissive. However, I have checked the security box just to be safe. If file permissions involved, there could always be an unseen security issue. I can see a situation where an application losing the ability to read a needed file causes system breakage, if not a security hole.
security vulnerability: | yes → no |
security vulnerability: | yes → no |
Changed in gvfs (Ubuntu): | |
assignee: | Ubuntu Desktop Bugs (desktop-bugs) → nobody |
Hi Apreche,
Thank you for the report as well as the detailed instructions to reproduce the issue. It's much appreciated. I've tried to confirm the issue you are seeing but am unsuccessful in reproducing the bug. I was able to follow your instructions completely up until step 11. In step 11, when I right clicked on the file, Nautilus by default didn't give me an option to launch gvim to open the file. I then decided to use the right-click->Open with Other Application ... which did allow me to select "GVim Text Editor". However, that did not open the file on the remote server, it actually opened a new file locally :( I guess that's a different bug I'll need to report. I even played with right-click- >Properties- >Open With tab to get GVim to launch properly but still had no luck. You mentioned you were able to reproduce this apart from using Nautilus, so I went ahead and tried opening/editing the file via the command line at Step 11 instead. I issued the following:
gvim sftp:// leann@leann/ /home/leann/ bug.txt
I was able to edit the remote file just fine and save my changes. The permissions (664) remained as they should. I did not witness the permissions changing to 600 as you were able to produce. I tried to issue the same type of command that you had documented (vim ~/.gvfs/sftp\ on\ remote/ home/user/ test.txt) at Step 11 but was unable to as my ~/.gvfs directory is empty. I'll include some of the package information I have below just to confirm we have the same versions of packages? Maybe there are some discrepancies which might account for why I'm unable to reproduce this issue? If you have any other ideas for triggering this, please let me know and I'll give it a test. I'll also see if I can have anyone else try and reproduce the issue as you've documented.
I'd like to add that there is a kernel patch that I was hoping to test to see if it would resolve this issue you are seeing bug since I am unable to reproduce the original bug, testing the patch doesn't make much sense.
Thanks.
ogasawara@yoji:/$ lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04
ogasawara@yoji:~$ cat /proc/version_ signature 16.30-generic
Ubuntu 2.6.24-
ogasawara@yoji:~$ apt-cache policy vim-gnome archive. ubuntu. com hardy/main Packages dpkg/status
vim-gnome:
Installed: 1:7.1-138+1ubuntu3
Candidate: 1:7.1-138+1ubuntu3
Version table:
*** 1:7.1-138+1ubuntu3 0
500 http://
100 /var/lib/
ogasawara@yoji:~$ apt-cache policy nautilus archive. ubuntu. com hardy/main Packages dpkg/status
nautilus:
Installed: 1:2.22.2-0ubuntu4
Candidate: 1:2.22.2-0ubuntu4
Version table:
*** 1:2.22.2-0ubuntu4 0
500 http://
100 /var/lib/
ogasawara@yoji:/$ apt-cache policy openssh-client archive. ubuntu. com hardy/main Packages dpkg/status
openssh-client:
Installed: 1:4.7p1-8ubuntu1
Candidate: 1:4.7p1-8ubuntu1
Version table:
*** 1:4.7p1-8ubuntu1 0
500 http://
100 /var/lib/
ogasawara@yoji:~$ apt-cache policy gvfs mirrors. cat.pdx. edu hardy-updates/m...
gvfs:
Installed: 0.2.3-0ubuntu5
Candidate: 0.2.3-0ubuntu5
Version table:
*** 0.2.3-0ubuntu5 0
500 http://