xref: /illumos-gate/usr/src/cmd/login/logindevperm.sh (revision 2654012f83cec5dc15b61dfe3e4a4915f186e7a6)
1#! /usr/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#
27# This is the script that generates the logindevperm file. It is
28# architecture-aware, and dumps different stuff for x86 and sparc.
29# There is a lot of common entries, which are dumped first.
30#
31# the SID of this script, and the SID of the dumped script are
32# always the same.
33#
34
35cat <<EOM
36#
37# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
38# Use is subject to license terms.
39#
40# /etc/logindevperm - login-based device permissions
41#
42# If the user is logging in on a device specified in the "console" field
43# of any entry in this file, the owner/group of the devices listed in the
44# "devices" field will be set to that of the user.  Similarly, the mode
45# will be set to the mode specified in the "mode" field.
46#
47# If the "console" is "/dev/vt/active" which is a symlink to the current
48# active virtual console (/dev/console, or /dev/vt/#), then the first
49# user to log into any virtual console will get ownership of all the
50# devices until they log out.
51#
52# "devices" is a colon-separated list of device names.  A device name
53# ending in "/*", such as "/dev/fbs/*", specifies all entries (except "."
54# and "..") in a directory.  A '#' begins a comment and may appear
55# anywhere in an entry.
56# In addition, regular expressions may be used. Refer to logindevperm(4)
57# man page.
58# Note that any changes in this file should be made when logged in as
59# root as devfs provides persistence on minor node attributes.
60#
61# console	mode	devices
62#
63/dev/vt/active	0600	/dev/mouse:/dev/kbd
64/dev/vt/active	0600	/dev/sound/*		# audio devices
65/dev/vt/active	0600	/dev/fbs/*		# frame buffers
66/dev/vt/active	0600	/dev/dri/*		# dri devices
67/dev/vt/active	0400	/dev/removable-media/dsk/*	# removable media
68/dev/vt/active	0400	/dev/removable-media/rdsk/*	# removable media
69/dev/vt/active	0400	/dev/hotpluggable/dsk/*		# hotpluggable storage
70/dev/vt/active	0400	/dev/hotpluggable/rdsk/*	# hotpluggable storage
71/dev/vt/active	0600	/dev/video[0-9]+	# video devices
72/dev/vt/active	0600	/dev/usb/hid[0-9]+	# hid devices should have the same permission with conskbd and consms
73/dev/vt/active	0600	/dev/usb/[0-9a-f]+[.][0-9a-f]+/[0-9]+/* driver=scsa2usb,usb_mid,usbprn,ugen	#libusb/ugen devices
74EOM
75
76case "$MACH" in
77    "i386" )
78	#
79	# These are the x86 specific entries
80	# It depends on the build machine being an x86
81	#
82	cat <<-EOM
83	EOM
84	;;
85    "sparc" )
86	#
87	# These are the sparc specific entries
88	# It depends on the build machine being a sparc
89	#
90	cat <<-EOM
91	EOM
92	;;
93    "ppc" )
94	#
95	# These are the ppc specific entries
96	# It depends on the build machine being a ppc
97	#
98	cat <<-EOM
99	EOM
100	;;
101    * )
102	echo "Unknown Architecture"
103		exit 1
104	;;
105esac
106