Bug 186085

Summary: Default shell config files in /usr/share/skel/ override path set by login.conf/login.conf.db
Product: Base System Reporter: Glen Neff <glen.neff>
Component: confAssignee: Bryan Drewery <bdrewery>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 9.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Glen Neff 2014-01-24 21:00:00 UTC
/etc/login.conf is a "flat-file" that defines, amongst other things, the default path for the system.  cap_mkdb(1) is used to write a hashed database of these settings to /etc/login.conf.db.

The problem, however, is that this default system path is overridden by the default per-user shell config files in /usr/share/skel/, specifically the dot.cshrc (which affects csh & tcsh) & dot.profile (which affects sh & bash).

This becomes a problem when you attempt to change the system path via /etc/login.conf & cap_mkdb(1) and your changes are nullified by the .cshrc and/or .profile files in users's home directories copied from /usr/share/skel/.

Fix: Remove path settings from the following files in /usr/share/skel/:

dot.cshrc
dot.profile

Patch attached with submission follows:
How-To-Repeat: Add/remove directories from the path in /etc/login.conf, run 'cap_mkdb /etc/login.conf', then login as a user with .cshrc and/or .profile files copied from /usr/share/skel/dot.cshrc & /usr/share/skel/dot.profile.
Comment 1 Bryan Drewery freebsd_committer freebsd_triage 2014-04-14 19:01:11 UTC
Responsible Changed
From-To: freebsd-bugs->bdrewery

I'll take it.
Comment 2 dfilter service freebsd_committer freebsd_triage 2014-04-14 19:07:04 UTC
Author: bdrewery
Date: Mon Apr 14 18:07:00 2014
New Revision: 264465
URL: http://svnweb.freebsd.org/changeset/base/264465

Log:
  Prefer /etc/login.conf for some of these environment values.
  
  PR:		conf/186085
  Reported by:	Glen Neff <glen.neff@emc.com>
  MFC after:	2 weeks
  Sponsored by:	EMC

Modified:
  head/share/skel/dot.cshrc
  head/share/skel/dot.profile

Modified: head/share/skel/dot.cshrc
==============================================================================
--- head/share/skel/dot.cshrc	Mon Apr 14 17:54:01 2014	(r264464)
+++ head/share/skel/dot.cshrc	Mon Apr 14 18:07:00 2014	(r264465)
@@ -12,14 +12,15 @@ alias la	ls -aF
 alias lf	ls -FA
 alias ll	ls -lAF
 
+# These are normally set through /etc/login.conf.  You may override them here
+# if wanted.
+# set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)
+# setenv	BLOCKSIZE	K
 # A righteous umask
-umask 22
-
-set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)
+# umask 22
 
 setenv	EDITOR	vi
 setenv	PAGER	more
-setenv	BLOCKSIZE	K
 
 if ($?prompt) then
 	# An interactive shell -- set some stuff up

Modified: head/share/skel/dot.profile
==============================================================================
--- head/share/skel/dot.profile	Mon Apr 14 17:54:01 2014	(r264464)
+++ head/share/skel/dot.profile	Mon Apr 14 18:07:00 2014	(r264465)
@@ -5,15 +5,16 @@
 # see also sh(1), environ(7).
 #
 
-# remove /usr/games if you want
-PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:$HOME/bin; export PATH
+# These are normally set through /etc/login.conf.  You may override them here
+# if wanted.
+# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:$HOME/bin; export PATH
+# BLOCKSIZE=K;	export BLOCKSIZE
 
 # Setting TERM is normally done through /etc/ttys.  Do only override
 # if you're sure that you'll never log in via telnet or xterm or a
 # serial line.
 # TERM=xterm; 	export TERM
 
-BLOCKSIZE=K;	export BLOCKSIZE
 EDITOR=vi;   	export EDITOR
 PAGER=more;  	export PAGER
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 3 Bryan Drewery freebsd_committer freebsd_triage 2014-04-14 19:07:06 UTC
State Changed
From-To: open->patched

Committed to head, will MFC later.
Comment 4 Bryan Drewery freebsd_committer freebsd_triage 2014-06-05 15:42:15 UTC
MFC'd in r266029