Bug 252951 - FreeBSD Handbook: Changing the Shell: only works for root
Summary: FreeBSD Handbook: Changing the Shell: only works for root
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Sergio Carlavilla Delgado
URL: https://docs.freebsd.org/en/books/han...
Keywords: needs-patch
Depends on:
Blocks: handbook-2022
  Show dependency treegraph
 
Reported: 2021-01-23 19:24 UTC by Jürgen Weber
Modified: 2023-01-28 11:00 UTC (History)
3 users (show)

See Also:


Attachments
Patch file for chsh instructions (975 bytes, patch)
2023-01-26 12:31 UTC, Ciarán Ainsworth
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jürgen Weber 2021-01-23 19:24:42 UTC
the given procedure should note, that chsh has to be run as root and needs a user argument, if the shell should not be changed for root.

sudo chsh -s /usr/local/bin/bash someuser

Run as non-root you get a password prompt, where it is not obvious that the password is for root:

chsh -s /usr/local/bin/bash
Password:
Comment 1 Trev 2021-01-23 21:52:38 UTC
(In reply to Jürgen Weber from comment #0)

FreeBSD 12.2-STABLE #2 r365646

lrwxr-xr-x  1 root  wheel  6 12 Sep 16:39 /usr/bin/chsh -> chpass
-r-sr-xr-x  1 root  wheel  23808 12 Sep 16:39 /usr/bin/chpass

You do not need to be root - notice the permissions on chpass

The password requested, if run by a user, is the user's password and not root.
Comment 2 Jürgen Weber 2021-01-23 23:00:41 UTC
OK, deep in the chsh man page it says that you must enter a password. 
Still, it is unusual for a user to have to enter his password.
It should be mentioned in the doc section, please.
Comment 3 Pau Amma 2022-06-06 00:13:54 UTC
(In reply to Jürgen Weber from comment #2)

Noting that this is for/about section 3.9.1.
Comment 4 Ciarán Ainsworth 2023-01-26 12:31:44 UTC
Created attachment 239721 [details]
Patch file for chsh instructions

I've added a line clarifying the password requirement to the handbook. I've also just added that the user needs to log off and back on to actually use the shell to avoid any confusion.
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-01-28 11:00:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/doc/commit/?id=0536b0e71685f6e1aca3d8f8aab20254a4bfdf92

commit 0536b0e71685f6e1aca3d8f8aab20254a4bfdf92
Author:     Ciarán Ainsworth <ciaranainsworth@posteo.net>
AuthorDate: 2023-01-28 10:55:44 +0000
Commit:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
CommitDate: 2023-01-28 10:55:44 +0000

    Basics handbook chapter - change shell clarifications

    * Clarify that the user must enter the password
    * Also note that log off and log in must be done

    PR:     252951

 documentation/content/en/books/handbook/basics/_index.adoc | 3 +++
 1 file changed, 3 insertions(+)
Comment 6 Sergio Carlavilla Delgado freebsd_committer freebsd_triage 2023-01-28 11:00:28 UTC
Thanks for the patch!