160405de4Skz151634#! /usr/bin/sh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 660405de4Skz151634# Common Development and Distribution License (the "License"). 760405de4Skz151634# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 2260405de4Skz151634# 23*aecfc01dSrui zang - Sun Microsystems - Beijing China# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate# 277c478bd9Sstevel@tonic-gate# This is the script that generates the logindevperm file. It is 287c478bd9Sstevel@tonic-gate# architecture-aware, and dumps different stuff for x86 and sparc. 297c478bd9Sstevel@tonic-gate# There is a lot of common entries, which are dumped first. 307c478bd9Sstevel@tonic-gate# 317c478bd9Sstevel@tonic-gate# the SID of this script, and the SID of the dumped script are 327c478bd9Sstevel@tonic-gate# always the same. 337c478bd9Sstevel@tonic-gate# 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gatecat <<EOM 367c478bd9Sstevel@tonic-gate# 37*aecfc01dSrui zang - Sun Microsystems - Beijing China# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 387c478bd9Sstevel@tonic-gate# Use is subject to license terms. 397c478bd9Sstevel@tonic-gate# 407c478bd9Sstevel@tonic-gate# /etc/logindevperm - login-based device permissions 417c478bd9Sstevel@tonic-gate# 427c478bd9Sstevel@tonic-gate# If the user is logging in on a device specified in the "console" field 437c478bd9Sstevel@tonic-gate# of any entry in this file, the owner/group of the devices listed in the 447c478bd9Sstevel@tonic-gate# "devices" field will be set to that of the user. Similarly, the mode 457c478bd9Sstevel@tonic-gate# will be set to the mode specified in the "mode" field. 467c478bd9Sstevel@tonic-gate# 47*aecfc01dSrui zang - Sun Microsystems - Beijing China# If the "console" is "/dev/vt/active" which is a symlink to the current 48*aecfc01dSrui zang - Sun Microsystems - Beijing China# active virtual console (/dev/console, or /dev/vt/#), then the first 49*aecfc01dSrui zang - Sun Microsystems - Beijing China# user to log into any virtual console will get ownership of all the 50*aecfc01dSrui zang - Sun Microsystems - Beijing China# devices until they log out. 51*aecfc01dSrui zang - Sun Microsystems - Beijing China# 527c478bd9Sstevel@tonic-gate# "devices" is a colon-separated list of device names. A device name 537c478bd9Sstevel@tonic-gate# ending in "/*", such as "/dev/fbs/*", specifies all entries (except "." 547c478bd9Sstevel@tonic-gate# and "..") in a directory. A '#' begins a comment and may appear 557c478bd9Sstevel@tonic-gate# anywhere in an entry. 567c478bd9Sstevel@tonic-gate# In addition, regular expressions may be used. Refer to logindevperm(4) 577c478bd9Sstevel@tonic-gate# man page. 587c478bd9Sstevel@tonic-gate# Note that any changes in this file should be made when logged in as 597c478bd9Sstevel@tonic-gate# root as devfs provides persistence on minor node attributes. 607c478bd9Sstevel@tonic-gate# 617c478bd9Sstevel@tonic-gate# console mode devices 627c478bd9Sstevel@tonic-gate# 63*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0600 /dev/mouse:/dev/kbd 64*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0600 /dev/sound/* # audio devices 65*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0600 /dev/fbs/* # frame buffers 66*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0600 /dev/dri/* # dri devices 67*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0400 /dev/removable-media/dsk/* # removable media 68*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0400 /dev/removable-media/rdsk/* # removable media 69*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0400 /dev/hotpluggable/dsk/* # hotpluggable storage 70*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0400 /dev/hotpluggable/rdsk/* # hotpluggable storage 71*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0600 /dev/video[0-9]+ # video devices 72*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0600 /dev/usb/hid[0-9]+ # hid devices should have the same permission with conskbd and consms 73*aecfc01dSrui zang - Sun Microsystems - Beijing China/dev/vt/active 0600 /dev/usb/[0-9a-f]+[.][0-9a-f]+/[0-9]+/* driver=scsa2usb,usb_mid,usbprn,ugen #libusb/ugen devices 747c478bd9Sstevel@tonic-gateEOM 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gatecase "$MACH" in 777c478bd9Sstevel@tonic-gate "i386" ) 787c478bd9Sstevel@tonic-gate # 797c478bd9Sstevel@tonic-gate # These are the x86 specific entries 807c478bd9Sstevel@tonic-gate # It depends on the build machine being an x86 817c478bd9Sstevel@tonic-gate # 827c478bd9Sstevel@tonic-gate cat <<-EOM 837c478bd9Sstevel@tonic-gate EOM 847c478bd9Sstevel@tonic-gate ;; 857c478bd9Sstevel@tonic-gate "sparc" ) 867c478bd9Sstevel@tonic-gate # 877c478bd9Sstevel@tonic-gate # These are the sparc specific entries 887c478bd9Sstevel@tonic-gate # It depends on the build machine being a sparc 897c478bd9Sstevel@tonic-gate # 907c478bd9Sstevel@tonic-gate cat <<-EOM 917c478bd9Sstevel@tonic-gate EOM 927c478bd9Sstevel@tonic-gate ;; 937c478bd9Sstevel@tonic-gate "ppc" ) 947c478bd9Sstevel@tonic-gate # 957c478bd9Sstevel@tonic-gate # These are the ppc specific entries 967c478bd9Sstevel@tonic-gate # It depends on the build machine being a ppc 977c478bd9Sstevel@tonic-gate # 987c478bd9Sstevel@tonic-gate cat <<-EOM 997c478bd9Sstevel@tonic-gate EOM 1007c478bd9Sstevel@tonic-gate ;; 1017c478bd9Sstevel@tonic-gate * ) 1027c478bd9Sstevel@tonic-gate echo "Unknown Architecture" 1037c478bd9Sstevel@tonic-gate exit 1 1047c478bd9Sstevel@tonic-gate ;; 1057c478bd9Sstevel@tonic-gateesac 106