Bug 269025 - fortune doesn't honor hushlogin
Summary: fortune doesn't honor hushlogin
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-18 09:02 UTC by as
Modified: 2024-02-29 05:12 UTC (History)
2 users (show)

See Also:


Attachments
dot.login patch (371 bytes, patch)
2023-01-19 06:19 UTC, as
no flags Details | Diff
dot.profile patch (413 bytes, patch)
2023-01-19 06:19 UTC, as
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description as 2023-01-18 09:02:37 UTC
Hi,

fortune(6) is executed from .profile or .login; however it doesn't seem to honor .hushlogin file

in other words if I touch ~/.hushlogin I would expect fortune not to be ran on login

I think a condition should be added to .profile && .login to skip fortune if ~/.hushlogin exists

Thanks!
Comment 1 as 2023-01-19 06:19:11 UTC
Created attachment 239578 [details]
dot.login patch

not sure if the patch is done the right way
Comment 2 as 2023-01-19 06:19:39 UTC
Created attachment 239579 [details]
dot.profile patch
Comment 3 Tatsuki Makino 2024-02-29 05:12:29 UTC
I have wondered the same thing a very long time ago :)

Existence of ~/.hushlogin changes the behavior of login(1) and sshd(8).
https: //cgit.freebsd.org/src/tree/usr.bin/login/login.c?h=releng/14.0#n444
https: //cgit.freebsd.org/src/tree/crypto/openssh/session.c?h=releng/14.0#n824

login(1) also behaves differently depending on ~/.login_conf.
It is enabled by writing me:hushlogin:
https: //cgit.freebsd.org/src/tree/usr.bin/login/login.c?h=releng/14.0#n416

It seems that sshd(8) is not reading ~/.login_conf.
It may have been read, but it seems that hushlogin has not been picked up.
https: //cgit.freebsd.org/src/tree/crypto/openssh/session.c?h=releng/14.0#n1384

The existence of a file is one condition, but there are also conditions under which it is no longer needed when the file does not exist.