LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   /usr permissions changing for converted packages? (https://www.linuxquestions.org/questions/slackware-14/usr-permissions-changing-for-converted-packages-4175617360/)

coralfang 11-10-2017 12:38 PM

/usr permissions changing for converted packages?
 
I've just noticed that the permissions on my /usr folder are not owned by root....
Code:

[ricky][1][darkstar|~]
$ ls -l /
total 116
drwxr-xr-x  2 root  root  4096 Oct 28 23:27 bin
drwxr-xr-x  4 root  root  4096 Oct 11 17:14 boot
drwxr-xr-x  19 root  root  5940 Nov 10 18:15 dev
drwxr-xr-x 124 root  root  12288 Nov 10 18:15 etc
drwxr-xr-x  4 root  root  4096 Apr 20  2017 home
drwxr-xr-x  7 root  root  4096 Nov  2 18:33 lib
drwxr-xr-x  2 root  root  20480 Nov  7 20:04 lib64
drwx------  2 root  root  16384 Jun 20  2014 lost+found
drwxr-xr-x  16 root  root  4096 May 31  2016 media
drwxr-xr-x  13 root  root  4096 Sep 26  2006 mnt
drwxr-xr-x  11 root  root  4096 Oct 24 14:10 opt
dr-xr-xr-x 221 root  root      0 Nov 10 18:08 proc
drwx--x---  49 root  root  12288 Nov 10 02:29 root
drwxr-xr-x  9 root  root    240 Nov 10 18:15 run
drwxr-xr-x  2 root  root  12288 Nov  3 00:52 sbin
drwxr-xr-x  2 root  root  4096 Sep 26  2016 slackarm
drwxr-xr-x  2 root  root  4096 Oct 25 17:43 srv
dr-xr-xr-x  12 root  root      0 Nov 10 18:08 sys
drwxrwxrwt  6 root  root    180 Nov 10 18:23 tmp
drwxr-xr-x  18 ricky users  4096 Nov  9 00:14 usr
drwxr-xr-x  16 root  root  4096 Nov  1 23:52 var

[ricky][1][darkstar|~]
$ ls -l /usr/
total 744
lrwxrwxrwx    1 root  root      5 May 31  2016 X11 -> X11R6
drwsrwsrwt    2 root  root    4096 May 31  2016 X11R6
lrwxrwxrwx    1 root  root      8 May 31  2016 adm -> /var/adm
drwxr-xr-x    4 ricky users 135168 Nov  9 00:14 bin
lrwxrwxrwx    1 root  root      10 May 31  2016 dict -> share/dict
drwxr-xr-x 1774 ricky users  73728 Nov  9 00:14 doc
drwxr-xr-x    2 root  root    4096 Jan 26  2017 games
drwxr-xr-x  595 root  root  69632 Nov  9 00:06 include
drwxr-xr-x    2 root  root  12288 Nov  6 22:58 info
drwxr-xr-x  58 root  root  69632 Nov  7 20:39 lib
drwxr-xr-x    2 root  root    4096 Feb  1  2015 lib32
drwxr-xr-x  254 ricky users 307200 Nov  9 00:14 lib64
drwxr-xr-x  28 root  root    4096 Nov  1 23:52 libexec
drwxr-xr-x  13 root  root    4096 Oct  8 20:37 local
drwxr-xr-x  64 ricky users  4096 Nov  9 00:14 man
drwxr-xr-x    2 root  root  20480 Nov  7 20:02 sbin
drwxr-xr-x  496 ricky users  20480 Nov  9 00:14 share
lrwxrwxrwx    1 root  root      10 May 31  2016 spool -> /var/spool
drwxr-xr-x    5 root  root    4096 Nov  7 20:39 src
lrwxrwxrwx    1 root  root      8 May 31  2016 tmp -> /var/tmp
drwxr-xr-x    4 root  root    4096 Sep 26 01:23 x86_64-slackware-linux

[ricky][1][darkstar|~]
$



However if i grep /usr/bin , i notice these permissions are only set from packages converted with rpm2tgz / deb2tgz, and they somehow changed the permissions of the top level folders. How can i stop the permissions on /usr from messing up in the future when installing packages like this?
Code:

[ricky][2][darkstar|/usr/bin]
$ ls -l | grep ricky
-rwxr-xr-x  1 ricky  users      5504 Oct 25 23:50 kodi
-rwxr-xr-x  1 ricky  users      1830 Oct 25 23:50 kodi-standalone
-rwxr-xr-x  1 ricky  users        322 Sep 22 15:39 skypeforlinux

[ricky][2][darkstar|/usr/bin]
$

Should be safe to just chown the entire /usr recursively back to root:root ?

coralfang 11-10-2017 12:59 PM

Okay i think i messed something up doing "chown root:root -R /usr"...

Code:

[ricky][3][darkstar|~]
$ sudo
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Fixed that one by logging in as root with "su" and then reinstalling sudo, but is there anything else obvious which could be broken after resetting permissions to root?

Petri Kaukasoina 11-10-2017 01:20 PM

Quote:

Originally Posted by coralfang (Post 5779138)
Okay i think i messed something up doing "chown root:root -R /usr"...


Fixed that one by logging in as root with "su" and then reinstalling sudo, but is there anything else obvious which could be broken after resetting permissions to root?

Every SUID or SGID binary and everything not owned by root:root.

bassmadrigal 11-10-2017 02:18 PM

Quote:

Originally Posted by coralfang (Post 5779131)
However if i grep /usr/bin , i notice these permissions are only set from packages converted with rpm2tgz / deb2tgz, and they somehow changed the permissions of the top level folders. How can i stop the permissions on /usr from messing up in the future when installing packages like this?
Code:

[ricky][2][darkstar|/usr/bin]
$ ls -l | grep ricky
-rwxr-xr-x  1 ricky  users      5504 Oct 25 23:50 kodi
-rwxr-xr-x  1 ricky  users      1830 Oct 25 23:50 kodi-standalone
-rwxr-xr-x  1 ricky  users        322 Sep 22 15:39 skypeforlinux

[ricky][2][darkstar|/usr/bin]
$


The obvious solution would be to not use those programs since there's no guarantee that an rpm or deb package will work on Slackware. kodi is available on SBo as is skypeforlinux. kodi does require compilation and dependencies, so it is a bit more work to get it, but then it is built against libraries on your computer. skypeforlinux is a simple repackaging of the deb package, but it has been verified to work on Slackware and won't jack up your ownership.

The other option would be to try running those conversion scripts as root, but I don't think it is normally required, so it might've been some option you passed when you ran them that adjusted the ownership of the files (I'm not really familiar with either since I refuse to use them -- I'd much rather repackage it by hand or develop a SlackBuild for it rather than use those).

coralfang 11-10-2017 02:27 PM

Quote:

Originally Posted by bassmadrigal (Post 5779171)
The obvious solution would be to not use those programs since there's no guarantee that an rpm or deb package will work on Slackware. kodi is available on SBo as is skypeforlinux. kodi does require compilation and dependencies, so it is a bit more work to get it, but then it is built against libraries on your computer. skypeforlinux is a simple repackaging of the deb package, but it has been verified to work on Slackware and won't jack up your ownership.

The other option would be to try running those conversion scripts as root, but I don't think it is normally required, so it might've been some option you passed when you ran them that adjusted the ownership of the files (I'm not really familiar with either since I refuse to use them -- I'd much rather repackage it by hand or develop a SlackBuild for it rather than use those).

Yeah, i haven't been able to build kodi from slackbuilds lately, it always fails with the included ffmpeg for some reason, so i had tried installing an rpm which ended up working for a bit.

As for me stupidly chowning my entire /usr, this shouldn't break my system should it?
So far i've only found "sudo" to be a problem so far.

Petri Kaukasoina 11-10-2017 02:56 PM

Quote:

Originally Posted by coralfang (Post 5779178)
As for me stupidly chowning my entire /usr, this shouldn't break my system should it?
So far i've only found "sudo" to be a problem so far.

There could be problems with: at cgexec chage chfn chsh crontab cu expiry fdmount gpasswd kppp lockfile mlocate newgidmap newgrp newuidmap passwd pkexec procmail rcp rlogin rsh slrnpull traceroute6 uucp uuname uustat uux wall write xlock xscreensaver

kjhambrick 11-10-2017 03:10 PM

Quote:

Originally Posted by coralfang (Post 5779178)
Yeah, i haven't been able to build kodi from slackbuilds lately, it always fails with the included ffmpeg for some reason, so i had tried installing an rpm which ended up working for a bit.

As for me stupidly chowning my entire /usr, this shouldn't break my system should it?
So far i've only found "sudo" to be a problem so far.

coralfang --

Yes there could be, especially for suid programs.

Below is a Q&D list of files under /usr/ on my system that are not chown root:root ( I also excluded stuff that may not affect your operation ).

Your list will vary because we've installed different packages and I don't have a pure-D Slackware64 14.2 System up-and-running at this minute, but it is a start.

The ones to fix are the ones with one-or more 's' bits set in the permissions column.

HTH.

-- kjh

Code:

# find . -type f -print0  | xargs -0 ls -lad  |grep -v -e 'root  *root' -e ./share/ -e  ./local/ -e ./man/

-rwxr-sr-x  1 root  tty        23416 Dec 15  2015 ./bin/32/wall
-rwxr-sr-x  1 root  tty        11820 Dec 15  2015 ./bin/32/write
-rwxr-xr-x  1 root  bin        12610 May 23  2009 ./bin/Pnews
-rwxr-xr-x  1 root  bin          6131 May 23  2009 ./bin/Rnmail
-rwxr-xr-x  1 root  bin        92624 Oct  2  2008 ./bin/amp
-rwsr-sr-x  1 daemon daemon      48040 Jun 29  2016 ./bin/at
-r-sr-xr--  1 uucp  uucp      156544 Oct 31  2008 ./bin/cu
-rwxr-xr-x  1 root  floppy      14992 Aug  2  2013 ./bin/diskd
-rwxr-xr-x  1 root  floppy      15072 Aug  2  2013 ./bin/diskseekd
-rwxr-xr-x  1 root  bin        23728 Oct 15  2008 ./bin/encapsulate
-rwxr-xr-x  1 root  bin        19400 Oct 15  2008 ./bin/faucet
-rwsr-x---  1 root  floppy      23200 Aug  2  2013 ./bin/fdmount
-rwxr-xr-x  1 root  floppy      11368 Aug  2  2013 ./bin/fdrawcmd
-rwxr-xr-x  1 root  floppy      21320 Aug  2  2013 ./bin/floppycontrol
-rwxr-xr-x  1 root  floppy      19400 Aug  2  2013 ./bin/floppymeter
-rwxr-xr-x  1 root  bin        34056 Oct 31  2008 ./bin/formail
-rwxr-xr-x  1 root  floppy      20464 Aug  2  2013 ./bin/getfdprm
-rwxr-xr-x  1 root  bin          7336 Oct 15  2008 ./bin/getpeername
-rwxr-xr-x  1 root  bin        19744 Oct 15  2008 ./bin/hose
-rwxr-sr-x  1 root  mail        16080 Oct 31  2008 ./bin/lockfile
-rwxr-xr-x  1 root  bin          5859 Oct 31  2008 ./bin/mailstat
-rwxr-xr-x  1 root  bin          2947 May 23  2009 ./bin/newsetup
-rwxr-xr-x  1 root  bin          1939 May 23  2009 ./bin/newsgroups
-rwxr-xr-x  1 news  news      278976 Nov 11  2009 ./bin/nn
-rwxr-xr-x  1 news  news          978 Nov 11  2009 ./bin/nngrab
-rwxr-xr-x  1 news  news        3312 Nov 11  2009 ./bin/nnstats
-rwxr-xr-x  1 root  bin        15408 May 23  2009 ./bin/nntplist
-rwxr-xr-x  1 news  news        1379 Nov 11  2009 ./bin/nnusage
-rwsr-sr-x  1 root  mail        81984 Oct 31  2008 ./bin/procmail
-rwxr-xr-x  1 root  bin        10856 Aug  3  2015 ./bin/psc
-rwxr-xr-x  1 root  bin        284968 Aug  3  2015 ./bin/sc
-rwxr-xr-x  1 root  bin        26360 Aug  3  2015 ./bin/scqref
-rwxr-xr-x  1 root  bin        112784 Dec 14  2008 ./bin/seejpeg
-rwxr-xr-x  1 root  floppy      41680 Aug  2  2013 ./bin/setfdprm
-rwxr-sr-x  1 root  slocate    36288 Aug 30  2012 ./bin/slocate
-rwxr-s---  1 root  news        95904 Apr 19  2015 ./bin/slrnpull
-rwxr-xr-x  1 root  bin          6752 Oct 15  2008 ./bin/sockdown
-rwxr-xr-x  1 root  floppy      64880 Aug  2  2013 ./bin/superformat
-rwxr-xr-x  1 root  bin          8408 Oct 15  2008 ./bin/timelimit
-rwxr-xr-x  1 root  bin        306920 May 23  2009 ./bin/trn
-rwxr-xr-x  1 root  bin        19520 May 23  2009 ./bin/trn-artchk
-r-sr-xr--  1 uucp  uucp      106432 Oct 31  2008 ./bin/uucp
-r-sr-xr--  1 uucp  uucp        46984 Oct 31  2008 ./bin/uuname
-r-sr-xr--  1 uucp  uucp      119144 Oct 31  2008 ./bin/uustat
-r-sr-xr--  1 uucp  uucp      108312 Oct 31  2008 ./bin/uux
-rwxr-sr-x  1 root  tty        27960 Dec 10  2015 ./bin/wall
-rwxr-sr-x  1 root  tty        15448 Dec 10  2015 ./bin/write
-rwxr-xr-x  1 root  floppy      15768 Aug  2  2013 ./bin/xdfcopy
-rwxr-s--x  1 root  shadow    3137336 Mar 19  2015 ./bin/xlock
-rwxr-s--x  1 root  shadow    243704 Jul  5 15:24 ./bin/xscreensaver
-rwxr-sr-x  1 root  postdrop    14912 Oct  1 04:10 ./sbin/postdrop
-rwxr-sr-x  1 root  postdrop    23136 Oct  1 04:10 ./sbin/postqueue
-r-sr-xr--  1 uucp  uucp      270648 Oct 31  2008 ./sbin/uucico
-r-sr-xr--  1 uucp  uucp      121792 Oct 31  2008 ./sbin/uuxqt
-rwsr-x---  1 root messagebus    56672 Jul 26 19:44 ./libexec/dbus-daemon-launch-helper
-rwxr-s--x  1 root games        14696 Sep 12 13:10 ./libexec/emacs/25.3/x86_64-slackware-linux/update-game-score
-rwxr-sr-x  1 root utmp          13568 Nov 21  2015 ./libexec/gnome-pty-helper
-rwxr-sr-x 1 root utmp    10096 Mar 19  2016 ./lib64/utempter/utempter
-rwxr-sr-x 1 root nogroup  54448 Jan 10  2016 ./lib64/kde4/libexec/kdesud
-rwxr-xr-x 1 news news    12638 Nov 11  2009 ./lib64/nn/aux
-rw-r--r-- 1 news news      998 Nov 11  2009 ./lib64/nn/conf
-rw-r--r-- 1 news news  267630 Nov 11  2009 ./lib64/nn/help/Manual
-rw-r--r-- 1 news news      396 Nov 11  2009 ./lib64/nn/help/adm.upgrade1
-rw-r--r-- 1 news news      670 Nov 11  2009 ./lib64/nn/help/adm.upgrade2
-rw-r--r-- 1 news news      630 Nov 11  2009 ./lib64/nn/help/adm.upgrade3
-rw-r--r-- 1 news news      481 Nov 11  2009 ./lib64/nn/help/adm.upgrade4
-rw-r--r-- 1 news news      540 Nov 11  2009 ./lib64/nn/help/adm.welcome
-rw-r--r-- 1 news news      324 Nov 11  2009 ./lib64/nn/help/help.attr
-rw-r--r-- 1 news news    2968 Nov 11  2009 ./lib64/nn/help/help.commands
-rw-r--r-- 1 news news    1349 Nov 11  2009 ./lib64/nn/help/help.extended
-rw-r--r-- 1 news news      310 Nov 11  2009 ./lib64/nn/help/help.help
-rw-r--r-- 1 news news      767 Nov 11  2009 ./lib64/nn/help/help.map
-rw-r--r-- 1 news news    1043 Nov 11  2009 ./lib64/nn/help/help.menu
-rw-r--r-- 1 news news    1206 Nov 11  2009 ./lib64/nn/help/help.more
-rw-r--r-- 1 news news      11 Nov 11  2009 ./lib64/nn/help/help.read
-rw-r--r-- 1 news news      407 Nov 11  2009 ./lib64/nn/help/help.set
-rw-r--r-- 1 news news      587 Nov 11  2009 ./lib64/nn/help/help.show
-rw-r--r-- 1 news news      876 Nov 11  2009 ./lib64/nn/help/help.sort
-rw-r--r-- 1 news news    7321 Nov 11  2009 ./lib64/nn/help/help.variables
-rwxr-xr-x 1 news news    1067 Nov 11  2009 ./lib64/nn/upgrade_rc


coralfang 11-10-2017 03:12 PM

Alright thanks... i just restarted the xserver, and it failed to load, so i just went and reinstalled xorg* packages, this fixed that.
Rebooted, everything seems fine, except for networkmanager not working. I had to use wpa_supplicant/dhcpcd manually to get online.

I think i'm just going to do this:
Code:

rsync -avP rsync://ftp.osuosl.org/slackware/slackware64-current/ .
And then reinstall/upgrade every package from there. This should fix all of these problems right?

kjhambrick 11-10-2017 03:16 PM

coralfang --

Yep, that outta do it :)

-- kjh

coralfang 11-10-2017 05:29 PM

Ok, lesson learned:
DO NOT RECURSIVELY CHOWN TOP LEVEL DIRECTORIES UNDER /

Took a while, but after reinstalling every package set to be safe, everything is back working as it should.
In case anyone reads this, having the same problem, you'll want to basically reinstall every package to get back the correct permissions. Seems to be the simplest way to go about doing this, as opposed to looking up each files individual permissions.

Solved i guess, and i'll probably stop installing converted deb/rpm packages in future to avoid this happening again.

bassmadrigal 11-10-2017 06:14 PM

Quote:

Originally Posted by coralfang (Post 5779178)
Yeah, i haven't been able to build kodi from slackbuilds lately, it always fails with the included ffmpeg for some reason, so i had tried installing an rpm which ended up working for a bit.

Feel free to create a new post on this, because I haven't had any issues with building kodi, although, I'm not running -current. If there is an issue in -current, I'm sure ponce would be happy to incorporate changes to the kodi SlackBuild in his repo.

glorsplitz 11-10-2017 08:36 PM

I built kodi in -current from slackbuilds about year ago without issue, worked fine.


All times are GMT -5. The time now is 08:23 AM.