Bug 156396

Summary: (patch) Password & User Account: Changing name brings a password dialog yielding "chfn:Permission denied"
Product: [Applications] systemsettings Reporter: Fabio Correa <facorread>
Component: kcm_useraccountAssignee: Frans Englich <frans.englich>
Status: RESOLVED FIXED    
Severity: normal CC: ach, andreas, andresbajotierra, arthur, arwald95, asturm, balcaen.john, betweensomeborders, blackst0ne.ru, danieljosecarvalho, davispuh, denis.koryavov, finex, god, johu, kde, kdesu-bugs-null, markotahal, martin.schnitkemper, mezin.alexander, ovit.debian, ozbekanil, rdieter, rjvbertin, samuel.a.ward, shubhadeepc, stupor_scurvy343, sudhir, vovochka13, wstephenson
Priority: NOR    
Version: 4.12.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.14.0
Sentry Crash Report:
Attachments: Disable Fullname editing
Backtrace of kcmshell4 kcm_useraccount when it's hangs

Description Fabio Correa 2008-01-22 17:45:51 UTC
Version:            (using KDE 4.0.0)
Installed from:    Gentoo Packages
Compiler:          x86_64-pc-linux-gnu-gcc 4.1.1 
OS:                Linux

Well, System Settings->About Me->Password & User Account is a frontend to chfn and passwd. Chfn does not allow to change the Full Name field of a regular user, except when run as root.

When you change the "Name" field, and click Apply, a new dialog prompts for the user password. When correctly entered, a message box appears showing "chfn:Permission denied". It does not matter if chfn is suid root.

Given I don't know what is the reason to prompt for a password in the first place, and then running a surely failing chfn command, it would be better to do one of the three following things:

o To disable the "Name" text box,
o To use a label instead of a text box for the "Name" field
o To not use chfn for the change of name, but just update the name field in the KDE config.
Comment 1 Dario Andres 2009-01-06 13:43:51 UTC
Here using:

Qt: 4.4.3 + qt-copy-patches-889120
KDE: 4.1.87 (KDE 4.1.87 (KDE 4.2 >= 20090101))
kdelibs svn rev. 906436 / kdebase svn rev. 906436
on ArchLinux x86_64 - Kernel 2.6.27.10

I can reproduce this bug
Comment 2 Dario Andres 2009-01-10 02:42:12 UTC
Adding kdesu-bugs-null@kde.org to the CC as this seems to be related to KDESu 
Comment 3 Achim Bohnet 2009-08-03 09:55:35 UTC
Created attachment 35806 [details]
Disable Fullname editing

Patch fixes the problem for the case that _no_ fullname editing is allowed via chfn. When there's no default set (e.g., via kmail or mailody), then the default fullname is extracted fro passwd's gecos field.

There is no check included to determine the chfn behaviour during runtime or buildtime.

See also: https://bugs.launchpad.net/bugs/390396
Comment 4 Christoph Feck 2010-04-10 16:52:32 UTC
*** Bug 233956 has been marked as a duplicate of this bug. ***
Comment 5 Vovochka 2011-03-29 02:13:32 UTC
It's KDE 4.6.0 but nobody cares about this bug :(
Comment 6 Balcaen John 2011-05-19 00:22:39 UTC
Created attachment 60134 [details]
Backtrace of kcmshell4 kcm_useraccount when it's hangs

I can reproduce here on a KDE 4.6.3

when launching on command line i can read
$ kcmshell4 kcm_useraccount                                       
kcmshell(1833)/kdesu (kdelibs) KDESu::PtyProcess::exec: [ /home/iurt/rpm/BUILD/kdelibs-4.6.3/kdesu/process.cpp : 293 ]  Running "chfn"  

and it's hanging
Attached is a bt (if it can help) of the loggi
Comment 7 Johannes Huber 2011-12-11 18:02:52 UTC
Bug still present in KDE SC 4.7.3.
Comment 8 Jesse 2011-12-18 22:22:37 UTC
Still present in KDE 4.8. Beta2
Comment 9 Johannes Huber 2012-02-09 13:30:22 UTC
ping
Comment 10 Denis Koryavov 2012-03-29 12:18:01 UTC
The patch is here: https://git.reviewboard.kde.org/r/104439/
Comment 11 stupor_scurvy343 2012-05-14 16:02:41 UTC
*** Bug 298694 has been marked as a duplicate of this bug. ***
Comment 12 Christoph Feck 2012-06-05 10:46:42 UTC
*** Bug 301201 has been marked as a duplicate of this bug. ***
Comment 13 Alexander Mezin 2012-09-18 08:07:40 UTC
It expects that chfn will ask for password, but chfn on my gentoo system never does this.
If i enable setting full name in login.defs (CHFN_RESTRICT frwh), then it asks for password (when it's not needed), and just freeze. If CHFN_RESTRICT doesn't contain 'f' (by default it doesn't), then full name must be changed using something like sudo chfn -f "New Name" login.

I think that changing full name in email settings and in passwd are different tasks. Why not change e-mail settings when chfn failed? I don't understand, why this commit is done: https://projects.kde.org/projects/kde/kde-baseapps/repository/revisions/8398bfba9d372f9c4fb3de597fbf7802e5f3a19c

Maybe the right way to do this is try to execute chfn -f
1) without password
2) using kdesu
And I think this must be done using separate button "Change system name" or something like this
Comment 14 Janek Bevendorff 2013-02-05 17:03:37 UTC
Updating version, still hanging in 4.10.
Comment 15 Christoph Feck 2013-04-04 13:05:46 UTC
*** Bug 317804 has been marked as a duplicate of this bug. ***
Comment 16 Andreas Sturmlechner 2013-06-01 07:09:06 UTC
Confirmed on a new install of 4.10.3. I'm glad that I am doing the setup there so the first bad impression on the user is avoided.
Comment 17 Denis M. (Phr33d0m) 2013-06-04 01:30:34 UTC
Hello, as I commented in the Gentoo bug report about this issue (https://bugs.gentoo.org/show_bug.cgi?id=380899) I found a workaround.

The workaround is as follows:
1. Edit /etc/login.defs and
1.1. Add 'f' to CHFN_RESTRICT if you didn't have it already, so now you should have: CHFN_RESTRICT           frwh
1.2. Uncomment CHFN_AUTH (remove #).
2. Logout.
3. Login.
4. Fixed. Now you should be able to change your name from the System Settings.
Comment 18 Denis M. (Phr33d0m) 2013-06-04 01:37:06 UTC
Okay, forget my previous comment. I got confused with the workaround. It seems that if the name contains a comma ',' it will change without issues. If it doesn't contain a comma it will crash.
Comment 19 Sudhir Khanger 2013-09-05 17:02:30 UTC
The bug still exist in 4.11.0-2 on Arch Linux.
Comment 20 blackst0ne 2013-10-23 04:25:14 UTC
The bug still exists in 4.11.2 on Gentoo Linux.
Comment 21 Martin Schnitkemper 2014-01-02 11:17:30 UTC
I confirm this bug on Arch-Linux and KDE-4.12.0, but I get not the "chfn:Permission denied"-message, systemsettings just hangs and does no longer respond.
Comment 22 Daniel 2014-01-10 10:54:15 UTC
*** Bug 329762 has been marked as a duplicate of this bug. ***
Comment 23 Sam Ward 2014-01-26 11:30:22 UTC
Confirmed in 4.12.1 in Gentoo. I was able to get my name in by making the /etc/login.defs changes. However to test it further I placed a comma at the end of my name and kcmshell4 kcm_useraccount worked as it should, but when I removed the comma it crashed and sent one of my CPU cores to 100%! Now I am unable to change it any further. Tried resetting login.defs and starting over, but it did not help. So don't put a comma in your name! I don't mind the comma so much as I do a runaway cpu core...
Comment 24 RJVB 2014-02-13 15:43:56 UTC
Confirmed for KDE 4.11.3 on Linux Mint Debian.

What's worse, System Settings doesn't appear to fetch the correct user information. I explain:

- I created a new user via kuser, setting the desired full name
- I copied over ~/.kde and ~/.config from my own account to the new account
- I set the correct owner and group ship on the target
- I removed/corrected the references to the source user

Logging in as the new user, everything seems to be correct, and finger indeed shows the desired user information, including the full name.
However, System Settings insists on showing the full name from the source account, and also the email address associated.

Where does it get that information from? Apparently chfn is used to change the full name info in /etc/passwd when a change is requested, but the data is obtained from elsewhere?
Comment 25 Achim Bohnet 2014-02-13 17:12:39 UTC
(In reply to comment #24)

Not really a bug.  You feed system settings the wrong information ;-)
The information is read from ~/.kde/share/config/emaildefaults
Comment 26 arwald95 2014-05-19 08:19:00 UTC
I can confirm that this bug still occurs on Arch Linux using KDE 4.13. I get no error message though, after applying the new name settings kcm_useraccount just freezes.
Comment 27 Dāvis 2014-06-29 14:22:18 UTC
I wasn't able to change user's name from settings using KDE 4.13.2 on Gentoo. It did asked for password and I entered it correctly, but still "Permission denied". But it worked fine using `sudo chfn -f Dāvis davis`
Comment 28 Dāvis 2014-06-29 14:32:58 UTC
actually no, chfn -f changed only in /etc/passwd but in KDE it still showed old one, but I was able to succesfully change after using this workaround

> The workaround is as follows:
> 1. Edit /etc/login.defs and
> 1.1. Add 'f' to CHFN_RESTRICT if you didn't have it already, so now you
> should have: CHFN_RESTRICT           frwh
> 1.2. Uncomment CHFN_AUTH (remove #).
> 2. Logout.
> 3. Login.
> 4. Fixed. Now you should be able to change your name from the System
> Settings.

maybe it's a feature? but then should have better error message, not just "Permission denied" which doesn't explain much.
Comment 29 AT 2014-07-13 17:02:24 UTC
Can confirm the freeze issue and sending 1 processor core to >100% load after changing user name on Sabayon with KDE 4.13.2
The above mentioned workaround doesn't work for me.

Could well be a feature, I find KDE 4 (still) is full of 'features' I would call a bug. :-(
Comment 30 stupor_scurvy343 2014-07-24 18:54:49 UTC
Git commit 00d66fec7aae9d50c46a68099a5189094cd1164e by Michael Palimaka, on behalf of Vishesh Handa.
Committed on 27/06/2014 at 11:32.
Pushed by palimaka into branch 'KDE/4.14'.

UserAccount KCM: Change the name using the AccountManager

Instead of calling chfn, parsing its output (which depends on the
version of chfn which is present) and also additionally requires the
password.

This is also much more secure since we aren't storing the password in
memory.

REVIEW: 118974
FIXED-IN: 4.14.0

Conflicts:
	kdepasswd/kcm/chfnprocess.cpp
	kdepasswd/kcm/chfnprocess.h

M  +0    -1    kdepasswd/kcm/CMakeLists.txt
D  +0    -103  kdepasswd/kcm/chfnprocess.cpp
D  +0    -33   kdepasswd/kcm/chfnprocess.h
M  +21   -31   kdepasswd/kcm/main.cpp

http://commits.kde.org/kde-baseapps/00d66fec7aae9d50c46a68099a5189094cd1164e