su errors out

I’m not sure if this is the correct forum category. Please move it if not.

Somehow while installing openSUSE 12.3 64bit I damaged my 12.2 installation on a separate partition. Now when I boot into 12.2, open a console and invoke “su” i get

:~> su
Password: 
su: cannot set groups: Operation not permitted

…and “sudo”

> sudo ls
sudo: effective uid is not 0, is sudo installed setuid root?

As far as I can see the ownership of all directories at the / level has been changed from root:root to a user1:users, user1 being myself. This may have happened when I was trying to copy my home directory to the newly installed 12.3. Is there any solution to this, like “chown -R / root:root” or do I have to re-install my 12.2?

I would normally just switch to using 12.3 except that a vital piece of emulator software does not work under 12.3 causing a total lock-up.

Thanks for any assistance.

A thought,
Instead of trying to change to root, try logging in with root and see if you have full functionality.

And maybe create a new User for testing, compare what is created to your existing.

TSU

To me it looks as if something basicaly is wrong. You have no idea what you did other then the vague expression “damaged”? (dropped it from the table …)

The first is a bit vague. Of course using su, does not only involve changing the userid to that of root, but also the groupid. And that seems to fail. The source of it could be very diverse. But it could be the same as the second one.

The suggestion here is that sudo is not setuid root (as it should be of course). That is easy to see with ( I show mine for comparison):

henk@boven:~> ls -l /usr/bin/sudo
-rwsr-xr-x 1 root root 121240 16 jul  2012 /usr/bin/sudo
henk@boven:~>

The s bit should be there. You can check if the same problem is true for su:

henk@boven:~> ls -l /usr/bin/su
-rwsr-xr-x 1 root root 44256 23 jan 14:04 /usr/bin/su
henk@boven:~>

It could also be that your (root) file system is mounted wrongly, preventing setuid root programs from being used as such. Let us see

mount | grep ' / '

Don’t chown root:root recursively. You’ll bork the system even more than it already is. If I’d see this on my system, I’d draw only one conclusion: reinstall. My bet is that reapplying your personal desires/needs to a new system is gonna take far less time and effort than repairing the individual permissions on every file and folder. For example “/home” is a folder, but the stuff in it should never be root:root. Another one: not all folders on the system are 755, not all files 644. In fact you’re already experiencing the misery that comes from broken permissions.

BTW: I don’t think the 12.3 install / upgrade itself has changed the perms/mounting of the 12.2 system.

Sorry, missed the last part of your original post. Yes, it seem that you did some chown there???
I am stronly with Knrurpht that you do not try to undo that by changing all and everything. That would be too much and make it even worse…

Can you explain what you think the “damage” was? You must have some idea.
Andd my last statement may still help:

mount | grep ' / '

On 03/17/2013 03:16 PM, Knurpht wrote:

> I’d draw only one conclusion: reinstall.

i agree…but, i do remember reading somewhere that there is CLI
magic to reset all the system permissions back to what they were by
default…but i can’t find it…WAIT, here it is…but, i have NO
idea if it still works (this note is years old!!)…oh wait, you have
to be able to log in as root! anyway, here it is…CAUTION read my
sig caveat before proceeding:

on a root console run the command:

chkstat --set /etc/permissions

and it should reset most/all of the incorrect file and directory
permission and/or ownership problems. As an alternative, run the
command:

/sbin/conf.d/SuSEconfig.permissions -set

which will do the same, but also apply the permissions set in the
specified permission level (easy, secure, or paranoid) as well as
those specified in the local permissions file: /etc/permissions.local

by the way you might wanna backup all your data prior to reinstalling…


dd
http://tinyurl.com/DD-Caveat

There is no problem for him to login as root (e.g. from the console at Ctrl-Alt-F1), there is only a problem in using programs, specialy suid programs.

On 2013-03-17 18:51, dd wrote:
> /sbin/conf.d/SuSEconfig.permissions -set

It has a limited effect.

It only modifies some permissions from what was set on the original rpm
archives. Ie, it applies some customizations.

What has to be done first is to apply the same permissions as stored in
the original rpms. I think I saw a trick to redo all that, but I can’t
find it.

(My guess on what caused the problem is that the OP copied over files as
user)


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

On 03/17/2013 07:58 PM, Carlos E. R. wrote:
> (My guess on what caused the problem is that the OP copied over files as
> user)

i guess he ran chown (as root) on the new 12.3 / recursively,
thinking he was running it only against ~/home


dd

So far I have full functionality so it’s not an immediate disaster.

He can’t. Not everything in “/” is owned by root:root. Think CUPS, Mysql, Firebird. Even if so, he’d need to take care that nothing is mounted, like /home.

I think I wanted to execute “chown -R ion:users /home/ion” and perhaps executed “chown -R ion:users / home/ion”. Note the space between “/” and “home/ion”

The root directory is mounted as follows:-

:~> mount | grep ' / '
/dev/sda2 on / type ext4 (rw,relatime,data=ordered)

It looks correct to me.

Advice followed. Thanks.

If so, it’s that space char that killed your system. It changed the perms of “/” to ion:users. The “-R” takes care that nothing below “/” is forgotten.

Thanks everyone for the many responses. I invoked

chown root:root /usr/bin/su

and

chmod u+s /usr/bin/su

so that

:~> ls -l /usr/bin/su
-rwsr-xr-x 1 root root 44256 Jan 23 07:04 /usr/bin/su

So now at least “su” is functional. I decided not to go any further as I am currently migrating to 12.3. My data is backed up to a USB drive and to a server, so I feel secure. Later I will re-install 12.2 as 12.3 doesn’t like either mame/mess or Vcc running under wine. Two essential emulators running my Sculptor database.

Thanks again.

When you do not post within CODE tags, we will not realy see that space :(. But I will believe you. And that is it possibly.

Nothing strange here. But we already decided that the cause is the (useless?) chmod.

I guess a reinstall is best. You seem to think that this is not serious, but IMHO you have a lot of booby traps in the system now. >:)

On 03/17/2013 10:06 PM, Knurpht wrote:
>
> dd;2536856 Wrote:
>> On 03/17/2013 07:58 PM, Carlos E. R. wrote:
>>> (My guess on what caused the problem is that the OP copied over files
>> as
>>> user)
>>
>> i guess he ran chown (as root) on the new 12.3 / recursively,
>> thinking he was running it only against ~/home
>>
>
> He can’t. Not everything in “/” is owned by root:root. Think CUPS,
> Mysql, Firebird. Even if so, he’d need to take care that nothing is
> mounted, like /home.

perhaps i do not understand but i was writing in past tense, and
speculating (as was Carlos, whose post i replied to and quoted) on
how this problem arose (not how to fix it)…and i guessed the OP ran
as root

chown -R user1:users

while in / rather than in
/home/user1 and thereby spoiled his system…

OH! reading ahead i see the OP now speculates he ran

chown -R
ion:users / home/ion

. . . but i think that would error out
when the system filed to find a directory named

/ home

(beginning with a space) like this:

chown: cannot access `
home/ion': No such file or directory

but, as said: perhaps i do not understand…


dd

On 2013-03-18 10:22, dd wrote:
> OH! reading ahead i see the OP now speculates he ran

chown -R
> ion:users / home/ion

. . . but i think that would error out

when the system filed to find a directory named

/ home

(beginning with a space) like this:

chown: cannot access `
> home/ion': No such file or directory

Yes, but that would happen after it acts on the “/” part.

I’m not willing to try on my system and see what happens :wink:


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)