Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Решено]Hplip: права доступа
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Russian
View previous topic :: View next topic  
Author Message
dimonchik230
n00b
n00b


Joined: 22 Nov 2021
Posts: 7

PostPosted: Mon Nov 22, 2021 2:14 am    Post subject: [Решено]Hplip: права доступа Reply with quote

Здравствуйте. Некоторое время назад по причинам смерти моего SSD диска, мне пришлось пересобирать всю систему с нуля. Где по памяти, где по оставшимся у меня наработкам я собрал почти идентичную прошлой систему. Отличие вылезло неожиданно. Есть у меня принтер HP, Inc Deskjet 2050 J510 с встроенным сканером. Настройка принтера осуществляется с помощью приложения net-print/hplip с включенными флагами:
Quote:
(X hpcups kde libnotify libusb0 policykit qt5 scanner snmp -doc -fax -hpijs -minimal -parport -static-ppds KERNEL="linux" PYTHON_SINGLE_TARGET="python3_9 -python3_8").

Мой пользователь включен в такие группы:
Quote:
группы=1000(dima),2(daemon),6(disk),7(lp),10(wheel),18(audio),19(cdrom),27(video),80(cdrw),85(usb),100(users),102(polkitd),106(lpadmin),272(plugdev),332(scanner),313(flatpak),60(mysql),385(gamemode),304(vboxusers)

Группа lpadmin позволяет моему пользователю устанавливать и настраивать принтеры на этом компьютере, не вижу ни чего страшного в этом так-как на этом компьютере один пользователь и это я. Принтер после установки работает, работает и сканер, но после каждой перегрузки компьютера для доступа к сканеру у меня постоянно запрашивают пароль ROOT.
В прошлой сборке, до поломки диска, такого не было. Если удалить net-print/hplip, то для доступа к сканерам пароль не запрашивают, проверенно на моем старом, полумертвом сканере Mustek 1248UB.
emerge --info
Quote:
Portage 3.0.28 (python 3.9.8-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-11.2.0, glibc-2.33-r7, 5.15.3-gentoo-dist x86_64)
=================================================================
System uname: Linux-5.15.3-gentoo-dist-x86_64-AMD_A8-7600_Radeon_R7,_10_Compute_Cores_4C+6G-with-glibc2.33
KiB Mem: 20456804 total, 15336440 free
KiB Swap: 10007548 total, 10007548 free
Timestamp of repository gentoo: Sun, 21 Nov 2021 09:30:01 +0000
Head commit of repository gentoo: 6b8e10390993b27a2d5896d52db088054ed367aa
sh bash 5.1_p8
ld GNU ld (Gentoo 2.37_p1 p0) 2.37
app-shells/bash: 5.1_p8::gentoo
dev-java/java-config: 2.3.1::gentoo
dev-lang/perl: 5.34.0-r3::gentoo
dev-lang/python: 2.7.18_p13::gentoo, 3.9.8::gentoo
dev-lang/rust: 1.56.1::gentoo
dev-util/cmake: 3.20.5::gentoo
sys-apps/baselayout: 2.7-r3::gentoo
sys-apps/sandbox: 2.25::gentoo
sys-devel/autoconf: 2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake: 1.13.4-r2::gentoo, 1.16.4::gentoo
sys-devel/binutils: 2.37_p1::gentoo
sys-devel/gcc: 11.2.0::gentoo
sys-devel/gcc-config: 2.4::gentoo
sys-devel/libtool: 2.4.6-r6::gentoo
sys-devel/make: 4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc: 2.33-r7::gentoo
Repositories:

gentoo
location: /usr/portage
sync-type: rsync
sync-uri: rsync://rsync.gentoo.org/gentoo-portage
priority: -1000
sync-rsync-verify-max-age: 24
sync-rsync-verify-metamanifest: yes
sync-rsync-extra-opts:
sync-rsync-verify-jobs: 1

myrepo
location: /usr/local/portage
masters: gentoo

dotnet
location: /var/lib/layman/dotnet
masters: gentoo
priority: 50

steam-overlay
location: /var/lib/layman/steam-overlay
masters: gentoo
priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=bdver3 -msse2 -mmmx -fomit-frame-pointer -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=bdver3 -msse2 -mmmx -fomit-frame-pointer -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=bdver3 -msse2 -mmmx -fomit-frame-pointer -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=bdver3 -msse2 -mmmx -fomit-frame-pointer -O2 -pipe"
GENTOO_MIRRORS="https://gentoo-mirror.alexxy.name/ http://gentoo-mirror.alexxy.name/ http://gentoo.bloodhost.ru/ ftp://gentoo.bloodhost.ru/ rsync://gentoo.bloodhost.ru/gentoo-distfiles https://mirror.yandex.ru/gentoo-distfiles/ http://mirror.yandex.ru/gentoo-distfiles/ ftp://mirror.yandex.ru/gentoo-distfiles/"
LANG="ru_RU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="ru_RU ru"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr egl emboss encode exif ffmpeg flac fortran gdbm gif gpm gstreamer gtk gui iconv icu imagemagick ipv6 java jpeg jpeg2k kde kipi kwallet lcms libglvnd libnotify libtirpc lzo mad mjpeg mng mp3 mp4 mpeg mtp multilib mysql ncurses networkmanager nls nptl ogg openexr opengl openmp pam pango pcre pdf plasma png policykit ppds pulseaudio python qml qt5 raw readline samba scanner sdl seccomp semantic-desktop spell split-usr ssl startup-notification svg systemd theora tiff truetype udev udisks unicode upower usb v4l vaapi vorbis wayland widgets wxwidgets x264 xattr xcb xinerama xml xv xvid zeroconf zlib" ABI_X86="64 32" ADA_TARGET="gnat_2019" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c fma3 fma4 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput evdev synaptics" KERNEL="linux" L10N="ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="scripting-javascript" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" SANE_BACKENDS="gt68xx" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS

net-print/cups
Quote:
net-print/cups
Доступные версии: 2.3.3-r4^t 2.3.3_p2-r2^t ~2.3.3_p2-r3^t **9999*l^t {X acl dbus debug kerberos lprng-compat pam selinux +ssl static-libs systemd +threads usb xinetd zeroconf ABI_MIPS="n32 n64 o32" ABI_S390="32 64" ABI_X86="32 64 x32" KERNEL="linux"}
Установленные версии: 2.3.3_p2-r2^t(19:35:26 02.11.2021)(X acl dbus pam ssl systemd threads usb -debug -kerberos -selinux -static-libs -xinetd -zeroconf ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="32 64 -x32" KERNEL="linux")
Домашняя страница: https://www.cups.org/ https://github.com/OpenPrinting/cups
Описание: The Common Unix Printing System

media-gfx/sane-backends
Quote:
media-gfx/sane-backends
Доступные версии: 1.0.31-r2 ~1.0.32 {gphoto2 ipv6 snmp systemd threads usb v4l xinetd +zeroconf ABI_MIPS="n32 n64 o32" ABI_S390="32 64" ABI_X86="32 64 x32" SANE_BACKENDS="+abaton +agfafocus +apple +artec +artec_eplus48u +as6e +avision +bh +canon +canon630u +canon_dr +canon_lide70 canon_pp +cardscan +coolscan +coolscan2 +coolscan3 +dc25 +dc210 +dc240 +dell1600n_net +dmc +epjitsu +epson +epson2 +escl +fujitsu +genesys +gt68xx +hp +hp3500 +hp3900 +hp4200 +hp5400 +hp5590 +hpljm1005 hpsj5s +hs2p +ibm +kodak +kodakaio +kvs20xx kvs40xx +kvs1025 +leo +lexmark +ma1509 +magicolor +matsushita +microtek +microtek2 +mustek mustek_pp +mustek_usb mustek_usb2 +nec +net +niash +p5 +pie +pieusb +pixma +plustek +plustek_pp pnm +qcam +ricoh +ricoh2 +rts8891 +s9036 +sceptre +sharp +sm3600 +sm3840 +snapscan +sp15c +st400 +stv680 +tamarack +teco1 +teco2 +teco3 +test +u12 +umax +umax1220u +umax_pp +xerox_mfp"}
Установленные версии: 1.0.31-r2(19:41:23 12.11.2021)(ipv6 systemd threads usb v4l zeroconf -gphoto2 -snmp -xinetd ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="32 64 -x32" SANE_BACKENDS="gt68xx -abaton -agfafocus -apple -artec -artec_eplus48u -as6e -avision -bh -canon -canon630u -canon_dr -canon_lide70 -canon_pp -cardscan -coolscan -coolscan2 -coolscan3 -dc25 -dc210 -dc240 -dell1600n_net -dmc -epjitsu -epson -epson2 -escl -fujitsu -genesys -hp -hp3500 -hp3900 -hp4200 -hp5400 -hp5590 -hpljm1005 -hpsj5s -hs2p -ibm -kodak -kodakaio -kvs20xx -kvs40xx -kvs1025 -leo -lexmark -ma1509 -magicolor -matsushita -microtek -microtek2 -mustek -mustek_pp -mustek_usb -mustek_usb2 -nec -net -niash -p5 -pie -pieusb -pixma -plustek -plustek_pp -pnm -qcam -ricoh -ricoh2 -rts8891 -s9036 -sceptre -sharp -sm3600 -sm3840 -snapscan -sp15c -st400 -stv680 -tamarack -teco1 -teco2 -teco3 -test -u12 -umax -umax1220u -umax_pp -xerox_mfp")
Домашняя страница: http://www.sane-project.org/
Описание: Scanner Access Now Easy - Backends


Спасибо.


Last edited by dimonchik230 on Tue Nov 23, 2021 11:39 am; edited 1 time in total
Back to top
View user's profile Send private message
dimonchik230
n00b
n00b


Joined: 22 Nov 2021
Posts: 7

PostPosted: Tue Nov 23, 2021 11:37 am    Post subject: Reply with quote

Отвечаю на свой же вопрос. Во время запуска любой программы для сканирования, программа обращается к polkit, точнее к org.freedesktop.systemd1.manage-units по поводу авторизации пользователя. При проверки этой политики:
Code:
$ pkaction --verbose --action-id org.freedesktop.systemd1.manage-units
org.freedesktop.systemd1.manage-units:
  description:       Manage system services or other units
  message:           Authentication is required to manage system services or other units.
  vendor:            The systemd Project
  vendor_url:        http://www.freedesktop.org/wiki/Software/systemd
  icon:             
  implicit any:      auth_admin
  implicit inactive: auth_admin
  implicit active:   auth_admin_keep

выясняем, что активному пользователю (не администратору) нужно единожды в этой сессии до выхода ввести пароль администратора (implicit active: auth_admin_keep), просто дадим нашему пользователю право на выполнение этой политики создав файл sudo nano /etc/polkit-1/rules.d/99-HP_sane.rules:
Code:
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.systemd1.manage-units" &&
        subject.user == "user") {
        return polkit.Result.YES;
    }
});

Где:
    action.id == "org.freedesktop.systemd1.manage-units" - нужная нам политика
    subject.user == "user" - логин нашего пользователя
    return polkit.Result.YES - предоставление права

Теперь при поиске доступных сканеров приложение пароль не запрашивает.
Можно сказать, что тема закрыта. Если будут какие либо советы я выслушаю.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Russian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum