Bug 362201 - The owner and group of a file end up being changed to "root" if it's used for example: kdesudo kate FILE
Summary: The owner and group of a file end up being changed to "root" if it's used for...
Status: RESOLVED DUPLICATE of bug 333577
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 5.0.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-24 19:44 UTC by Ganton
Modified: 2017-02-26 16:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ganton 2016-04-24 19:44:35 UTC
Hi! I suppose you already know that, but I haven't found a bug about it: In previous versions of Plasma, if the user executed
    kdesudo kate FILE
and saved the file, then the owner and group of FILE were respected. However, nowadays the owner and group of FILE end up being "root".

Note: The operating system is Kubuntu 16.04 and in <https://bugs.launchpad.net/kdesudo/+bug/1430761/comments/2> Jonathan Riddell wrote that "kdesudo has moved to KDE infrastructure. If you feel your bug is still relevant please open a new bug on bugs.kde.org", so I'm writing here.

Thanks for all!


Reproducible: Always

Steps to Reproduce:
1. Execute: kdesudo kate FILE
2. Write something, save FILE

Actual Results:  
See that the owner and the group of FILE are "root".


Expected Results:  
It was expected that the owner and the group of FILE were the same as they were before. This was the behavior in the prior Kubuntu LTS version (14.04), and the previous ones.
Comment 1 Christoph Feck 2016-04-27 10:50:22 UTC
If the file is not owned by root, why are you using a root account to edit it?
Comment 2 Ganton 2016-04-27 15:38:35 UTC
For example some files are scripts in /usr/local/bin, scripts owned by root, but with a group that is not root; if those files are edited with kdesudo kate, then the group is not respected (and so the group of those files ends up being root, too).
Comment 3 Vijit 2016-06-30 09:03:06 UTC
I got the similar problem. 

I created the file from PHP, owner "www-data", access mode "0644". Then I open it in Kate under my account (user: Vijit, sudoers group, inter alia). Inspite of I haven't access to write, I can do it in Kate! And after saving the changes the owner of this file changes too. It become "vijit".

I suppose, Kate creates the backup file (*.kate-swp) with owner of me, of course, and then changes the original one on saving.

So, I believe, we got an access violation here.
Comment 4 Buovjaga 2016-07-11 12:19:05 UTC
Changing to confirmed per comment 3
Comment 5 Dominik Haumann 2017-02-26 16:43:07 UTC
This is a duplicate of bug #333577.

If you want to edit files as root, please follow: https://blog.martin-graesslin.com/blog/2017/02/editing-files-as-root/
In short, use: SUDO_EDITOR=kwrite sudoedit <file>

Commit: https://cgit.kde.org/kate.git/commit/?id=9adcebd3c2e476c8a32e9b455cc99f46b0e12a7e
Discussion: git.net/ml/kwrite-devel/2016-01/msg00011.html

Of course, in general, the problem with changing file owner still exists, see duplicate report.

*** This bug has been marked as a duplicate of bug 333577 ***