You are not logged in.

#1 2013-01-12 18:39:30

beroal
Member
From: Ukraine
Registered: 2009-06-07
Posts: 384
Website

Permission denied to "/dev/sr0" on VT6

I run several SLiM instances on different VTs (virtual terminals) (this is possible with my patch) so I can log in as different users. Of course, I can log in as some user in all VTs. Mplayer (and other video players) does not play a video DVD on VT6, but plays on VT5, VT7, VT8 under the same user. SystemD files for all SLiM instances are identical except for VT numbers and Xorg server display numbers. I can mount "/dev/sr0" with "udisks". (Mplayer plays DVD without mounting.)

So, there is "VT6" or ":1" hardwired in some program. I know that it is easy to blame SLiM or my patch as "non-standard" and close the case. I want to fix this, so I need to know how SystemD gives permissions to "/dev/sr0". I noticed that on VT6:

brw-------+ 1 root root 11, 0 січ 12 20:11 /dev/sr0

on VT5, VT7, VT8:

brw-rw----+ 1 root root 11, 0 січ 12 20:11 /dev/sr0

There is a difference, but my user is not in the "root" group, so I'm not sure that this difference is relevant.

$ cat /etc/group | grep root
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin
adm:x:4:root,daemon
wheel:x:10:root
log:x:19:root
pulse-access:x:1005:root,user,slut,test

/etc/systemd/system/slim-vt-5.service

[Unit]
Description=SLiM Simple Login Manager
After=systemd-user-sessions.service

[Service]
ExecStart=/usr/bin/slim -nodaemon -c /etc/systemd/system/slim-vt-5.conf

[Install]
WantedBy=graphical.target

/etc/systemd/system/slim-vt-5.conf

display_name :0
xserver_arguments -nolisten tcp vt05
lockfile /var/lock/slim-vt-5.lock
authfile /var/run/slim-vt-5.auth

/etc/systemd/system/slim-vt-6.service

[Unit]
Description=SLiM Simple Login Manager
After=systemd-user-sessions.service

[Service]
ExecStart=/usr/bin/slim -nodaemon -c /etc/systemd/system/slim-vt-6.conf

[Install]
WantedBy=graphical.target

/etc/systemd/system/slim-vt-6.conf

display_name :1
xserver_arguments -nolisten tcp vt06
lockfile /var/lock/slim-vt-6.lock
authfile /var/run/slim-vt-6.auth

/etc/slim.conf

# Path, X server and arguments (if needed)
# Note: -xauth $authfile is automatically appended
default_path        /bin:/usr/bin:/usr/local/bin
default_xserver     /usr/bin/X
xserver_arguments -nolisten tcp vt01

# Commands for halt, login, etc.
halt_cmd            /sbin/shutdown -h now
reboot_cmd          /sbin/shutdown -r now
console_cmd         /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -c "/bin/cat /etc/issue; exec /bin/login"
#suspend_cmd        /usr/sbin/suspend

# Full path to the xauth binary
xauth_path         /usr/bin/xauth 

# Xauth file for server
authfile           /var/run/slim.auth


# Activate numlock when slim starts. Valid values: on|off
# numlock             on

# Hide the mouse cursor (note: does not work with some WMs).
# Valid values: true|false
# hidecursor          false

# This command is executed after a succesful login.
# you can place the %session and %theme variables
# to handle launching of specific commands in .xinitrc
# depending of chosen session and slim theme
#
# NOTE: if your system does not have bash you need
# to adjust the command according to your preferred shell,
# i.e. for freebsd use:
# login_cmd           exec /bin/sh - ~/.xinitrc %session
login_cmd           exec /bin/bash -login ~/.xinitrc %session

# Commands executed when starting and exiting a session.
# They can be used for registering a X11 session with
# sessreg. You can use the %user variable
#
# sessionstart_cmd	some command
# sessionstop_cmd	some command

# Start in daemon mode. Valid values: yes | no
# Note that this can be overriden by the command line
# options "-d" and "-nodaemon"
# daemon	yes

# Available sessions (first one is the default).
# The current chosen session name is replaced in the login_cmd
# above, so your login command can handle different sessions.
# see the xinitrc.sample file shipped with slim sources
sessions            xfce4,icewm-session,wmaker,blackbox

# Executed when pressing F11 (requires imagemagick)
screenshot_cmd      import -window root /slim.png

# welcome message. Available variables: %host, %domain
welcome_msg         Welcome to %host

# Session message. Prepended to the session name when pressing F1
# session_msg         Session: 

# shutdown / reboot messages
shutdown_msg       The system is halting...
reboot_msg         The system is rebooting...

# default user, leave blank or remove this line
# for avoid pre-loading the username.
default_user        user

# Focus the password field on start when default_user is set
# Set to "yes" to enable this feature
#focus_password      no

# Automatically login the default user (without entering
# the password. Set to "yes" to enable this feature
#auto_login          no


# current theme, use comma separated list to specify a set to 
# randomly choose from
current_theme       default

# Lock file
lockfile            /var/lock/slim.lock

# Log file
logfile             /var/log/slim.log

we are not condemned to write ugly code

Offline

#2 2013-01-12 19:28:42

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: Permission denied to "/dev/sr0" on VT6

Run "loginctl show-session $XDG_SESSION_ID" and see if you have Active=yes in VT6.

Offline

#3 2013-01-13 00:01:02

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Permission denied to "/dev/sr0" on VT6

Udev grants access to things that groups used to take care of.  The uaccess tag is what handles this.  You can see exactly what is included by viewing the file /usr/lib/udev/rules.d/70-uaccess.rules/.  Though I am not sure that this is going to help you get the appropriate access to that particular VT... maybe it will be a start in your path to (hopeful) enlightenment.

Offline

#4 2013-01-13 03:26:03

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: Permission denied to "/dev/sr0" on VT6

The + in the permissions listing shows ACLs present for those cases. You need to show us the ACLs for the two cases in order to see if there is an effective difference in the permissions.

EDIT: I don't have /dev/sr0 but for cases under /dev where an ACL is relevant (i.e. non-default), I find it confers permissions for my user. So you should definitely look at that.

I'm not sure. Are these managed by udev? Or does systemd handle any of this directly?

EDIT 2: Forget that question. Forgot that udev is now part of systemd.

Last edited by cfr (2013-01-13 03:31:19)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2013-01-14 15:33:50

beroal
Member
From: Ukraine
Registered: 2009-06-07
Posts: 384
Website

Re: Permission denied to "/dev/sr0" on VT6

anonymous_user wrote:

Run "loginctl show-session $XDG_SESSION_ID" and see if you have Active=yes in VT6.

Id=6
Timestamp=Mon, 2013-01-14 17:31:04 EET
TimestampMonotonic=23748508447
DefaultControlGroup=name=systemd:/user/slut/6
VTNr=0
Display=:1
Remote=no
RemoteUser=root
Service=slim
Leader=2297
Audit=6
Type=x11
Class=user
Active=yes
State=active
KillProcesses=no
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0
Name=slut

Last edited by beroal (2013-01-14 15:38:43)


we are not condemned to write ugly code

Offline

#6 2013-01-14 15:38:29

beroal
Member
From: Ukraine
Registered: 2009-06-07
Posts: 384
Website

Re: Permission denied to "/dev/sr0" on VT6

/usr/lib/udev/rules.d/70-uaccess.rules

…
# optical drives
SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="uaccess"
SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="uaccess"
…

we are not condemned to write ugly code

Offline

#7 2013-01-14 16:08:12

beroal
Member
From: Ukraine
Registered: 2009-06-07
Posts: 384
Website

Re: Permission denied to "/dev/sr0" on VT6

cfr wrote:

The + in the permissions listing shows ACLs present for those cases.

getfacl:
VT7:

# file: dev/sr0
# owner: root
# group: root
user::rw-
user:slut:rw-
group::---
mask::rw-
other::---

VT6:

# file: dev/sr0
# owner: root
# group: root
user::rw-
group::---
mask::---
other::---

Indeed, the user "slut" under VT6 has no access.


we are not condemned to write ugly code

Offline

Board footer

Powered by FluxBB