Em que usuário o apt-get instala o software?

0

Acabei de instalar algum software usando apt-get e seu proprietário e grupo é "logger". Desde que instalei o software usando sudo , por que o dono e o grupo não são "root"? Tenho certeza de que, há um ano, renomei o usuário pi com o novo nome logger . Isso poderia ter causado isso e, em caso afirmativo, por quê?

michael@rp3:~ $ ls -l /usr | grep local
drwxrwsr-x  12 root staff  4096 Dec 23 16:49 local
michael@rp3:~ $ ls -l /usr/local
total 32
drwxrwsr-x 2 root staff 4096 Dec 23 16:47 bin
drwxrwsr-x 2 root staff 4096 Apr 10  2017 etc
drwxrwsr-x 2 root staff 4096 Apr 10  2017 games
drwxrwsr-x 2 root staff 4096 Apr 10  2017 include
drwxrwsr-x 4 root staff 4096 Jun  4  2017 lib
lrwxrwxrwx 1 root staff    9 Apr 10  2017 man -> share/man
drwxrwsr-x 2 root staff 4096 Apr 10  2017 sbin
drwxrwsr-x 7 root staff 4096 Dec 23 15:20 share
drwxrwsr-x 2 root staff 4096 Apr 10  2017 src
michael@rp3:~ $ sudo apt-get install test-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  test-utils
The following NEW packages will be installed:
  test-client test-utils
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,575 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  test-utils test-client
Install these packages without verification? [y/N] y
Selecting previously unselected package test-utils.
(Reading database ... 41030 files and directories currently installed.)
Preparing to unpack .../test-utils_0.1.1-jessie_armhf.deb ...
Unpacking test-utils (0.1.1-jessie) ...
Selecting previously unselected package test-client.
Preparing to unpack .../test-client_0.1.2-jessie_armhf.deb ...
Unpacking test-client (0.1.2-jessie) ...
Setting up test-utils (0.1.1-jessie) ...
Setting up test-client (0.1.2-jessie) ...
michael@rp3:~ $ ls -l /usr/local
total 40
drwxrwxr-x 6 logger logger 4096 Dec 23 16:49 test-client
drwxrwxr-x 3 logger logger 4096 Dec 23 16:49 test-utils
drwxrwsr-x 2 root   staff  4096 Dec 23 16:49 bin
drwxrwsr-x 2 root   staff  4096 Apr 10  2017 etc
drwxrwsr-x 2 root   staff  4096 Apr 10  2017 games
drwxrwsr-x 2 root   staff  4096 Apr 10  2017 include
drwxrwsr-x 4 root   staff  4096 Jun  4  2017 lib
lrwxrwxrwx 1 root   staff     9 Apr 10  2017 man -> share/man
drwxrwsr-x 2 root   staff  4096 Apr 10  2017 sbin
drwxrwsr-x 7 root   staff  4096 Dec 23 15:20 share
drwxrwsr-x 2 root   staff  4096 Apr 10  2017 src

michael@rp3:~ $ cat /etc/passwd | grep 'apt\|logger\|root\|michael'
root:x:0:0:root:/root:/bin/bash
michael:x:1001:1001:,,,:/home/michael:/bin/bash
_apt:x:109:65534::/nonexistent:/bin/false
logger:x:1000:1000:,,,:/home/logger:/bin/bash
michael@rp3:~ $ cat /etc/group | grep 'apt\|logger\|root\|michael'
root:x:0:
michael:x:1001:
wireshark:x:114:michael
logger:x:1000:
michael@rp3:~ $ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
michael  ALL=(ALL:ALL) ALL
anton   ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
michael@rp3:~ $ ls -l /etc/sudoers.d
total 8
-r--r----- 1 root root  27 Oct 18  2016 010_pi-nopasswd
-r--r----- 1 root root 958 Jan 11  2016 README
michael@rp3:~ $ sudo cat /etc/sudoers.d/*
pi ALL=(ALL) NOPASSWD: ALL
#
# As of Debian version 1.7.2p1-1, the default /etc/sudoers file created on
# installation of the package now includes the directive:
#
#       #includedir /etc/sudoers.d
#
# This will cause sudo to read and parse any files in the /etc/sudoers.d
# directory that do not end in '~' or contain a '.' character.
#
# Note that there must be at least one file in the sudoers.d directory (this
# one will do), and all files in this directory should be mode 0440.
#
# Note also, that because sudoers contents can vary widely, no attempt is
# made to add this directive to existing sudoers files on upgrade.  Feel free
# to add the above directive to the end of your /etc/sudoers file to enable
# this functionality for existing installations if you wish!
#
# Finally, please note that using the visudo command is the recommended way
# to update sudoers content, since it protects against many failure modes.
# See the man page for visudo for more information.
#
michael@rp3:~ $
    
por user1032531 23.12.2017 / 18:19

2 respostas

3

apt-get , ou melhor, dpkg , instala o conteúdo do pacote usando qualquer usuário registrado como proprietário dos vários arquivos no pacote. Isso geralmente é root:root , mas pode ser qualquer coisa; você normalmente verá root:games em pacotes de jogos, root:www-data para determinados diretórios em pacotes relacionados a servidores web, etc. (Propriedade e permissões também podem ser definidas por scripts de mantenedores, mas isso geralmente não é necessário.)

Se um pacote for criado manualmente em um sistema estilo Raspberry Pi, sem prestar muita atenção à propriedade (e não usar fakeroot ), seria perfeitamente possível acabar com um pacote contendo arquivos pertencentes a pi:pi , identificado numericamente. No seu sistema, eles acabariam pertencendo a logger:logger .

Você pode ver as informações de propriedade contidas em um pacote usando dpkg-deb -c .

    
por 23.12.2017 / 22:00
4

Os pacotes Debian podem definir permissões de arquivos e propriedade em seus scripts postinst.

    
por 23.12.2017 / 18:51