LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Can't switch to root as user (https://www.linuxquestions.org/questions/slackware-14/cant-switch-to-root-as-user-4175497811/)

moisespedro 03-11-2014 09:30 AM

Can't switch to root as user
 
On any tty I can log as root just fine. But if I am logged as user and I try "su" or "su -" I can't do it. It gives me an "authentication error". What happened?

Alien Bob 03-11-2014 09:58 AM

Only you can tell us what happened. This should work, unless you configured the /etc/suauth file. Or perhaps you messed with the keyboard definitions and are typing something else than you think?

Eric

moisespedro 03-11-2014 10:09 AM

I can't tell because I didn't do anything. I was using the llvm.SlackBuild and on the chown part I received a bunch of "not authorized operation". I found it weird because I was running it as root (logged as root on an urxvt terminal, X session was being run by an user). I don't see how that could be related to this matter but that is what I was doing. And I didn't mess with the keyboard because I can log as root just fine, if it is the first login. I just can't switch to root from an existing user.

Alien Bob 03-11-2014 11:00 AM

I don't understand. You are root, and then you run llvm.SlackBuild ? Then there is no involvement of your normal user account, and "su" is not called from the SlackBuild at all.

How about your filesystem, what type is it? Is this a FAT filesystem, or a readonly filesystem where you are running these chown commands? My guess is that this has nothing to do with root or su but with the storage filesystem.

Eric

GazL 03-11-2014 11:02 AM

Sounded familar:
http://www.linuxquestions.org/questi...or-4175432061/

Was it an old version of the slackbuild?

moisespedro 03-11-2014 11:21 AM

Quote:

Originally Posted by Alien Bob (Post 5132696)
I don't understand. You are root, and then you run llvm.SlackBuild ? Then there is no involvement of your normal user account, and "su" is not called from the SlackBuild at all.

How about your filesystem, what type is it? Is this a FAT filesystem, or a readonly filesystem where you are running these chown commands? My guess is that this has nothing to do with root or su but with the storage filesystem.

Eric

ext4, the errors are probaly unrelated to what the slackbuild did but they appeared the first time while I was running it.

@GazL I retrieved the one on the slackware 14.1 source tree, it was made for llvm 3.3 and I was trying to build llvm 3.4

perbh 03-11-2014 11:23 AM

I have something similar happening every so often - and I have never been able to figure out why :-(
Scenario:
1) file-server running slackware-13.37 (nfs-export)
2) client running slackware-14.1 (though I also experienced the same problem with 14.0)
3) seeing I sudo to root fairly often, I make doubly sure that all the exported directories and files are 'rw'-accessible to everyone.

My problem comes when I 'cd' deep into the hierarchy (as 'root'), do a 'ls' to make sure the file I want is there and then 'vi' on the file.
I get an error-message saying "No path to file" The same happens if I try to do a 'chmod' on it, even though its allready marked as 'rw'. However, I _can_ 'cat' the file!

The solution: Step up one level and do a 'chmod -R' on the directory, then go back again and everything is allright!

This doesn't happen all the time, just occasionally (like maybe once/month) and seeing I know what to do, I decided just to live with it.

@OP:
Could this be something similar to what you have experienced?

ps. I forgot to mention - I can make _new_ files in the directory, just not allowed to access existing ones.

NeoMetal 03-11-2014 11:28 AM

Anything logged in /var/log/secure when you try to su ?

GazL 03-11-2014 11:42 AM

Unfortunately, the slackbuild in 14.1 still has potential for damage:

Code:

cd $TMP
rm -rf $PKGNAM-${VERSION}.src
tar xvf $CWD/$PKGNAM-$VERSION.src.tar.xz || exit 1

cd $PKGNAM-${VERSION}.src/tools
  tar xvf $CWD/cfe-$VERSION.src.tar.xz || exit 1
  mv cfe-${VERSION}.src clang || exit 1
cd ../

chown -R root:root .
chmod -R u+w,go+r-w,a-s .

If that cd doesn't work, the subsequent 'cd ../' will take you from /tmp to '/' and then you're heading for a world of hurt when the chown/chmod gets run. I suspect that is what happened to you.

moisespedro 03-11-2014 12:05 PM

Well, I had a clonezilla backup so it is all fine now. And yes I guess that was what happened. Next time, I gonna check all the directories before trying to build it.

GazL 03-11-2014 12:08 PM

FWIW, I borrowed the llvm 3.4 build tree from slackware-current and built it on 14.1. If you want the update, then that is probably the best way to go.

Glad you had a backup. :)

moisespedro 03-11-2014 12:13 PM

Hmm, I didn't know slackware-current was running llvm 3.4. Thanks for the tip.

MadMaverick9 03-11-2014 11:36 PM

Hope you learned your lesson from all this.

You never run a build script as root. Never.

https://docs.fedoraproject.org/en-US...s02s02s02.html
The same goes for Slackware packages.

You should use fakeroot.

Here are some good explanations why:
https://www.linuxquestions.org/quest...3/#post4970455
https://www.linuxquestions.org/quest...3/#post4874270

http://www.tldp.org/LDP/lame/LAME/li...t-account.html
You create your Slackware package as a regular user using fakeroot and you install them as root.

The only time this rule failed on me, was when I tried to build Gtk+ 2.24.10 on 13.37. What you do then, is create a VM where it doesn't matter if things get messed up, because you can just delete the VM and re-create it.

PS: If you create Slackware packages as a regular user without fakeroot, then your "/usr/bin/" directory will suddenly be owned by you, instead of root, after installing the package. If you're lucky, your Slackbuild will simply fail because you can't do a "chown root" as a regular user. If you're unlucky, your permissions and ownership on system directories will get messed up after installing your package.

moisespedro 03-12-2014 07:39 AM

Will setup fakeroot when I get home, can you use sbopkg with fakeroot?

ruario 03-12-2014 08:13 AM

@MadMaverick9 actually I said, I don't tend to use root for these things and that you don't need to. The risk in using root for SBo is pretty low given the scripts are reviewed, so in that case its fine using root and in fact this is the only supported (by the SBo guys) method.

You can use fakeroot but it requires setting up things like your $PATH to include /sbin, /usr/sbin, etc. and in the case of sbopkg changing the ownership of various files in /var. To put it another way it is more effort to setup fakeroot and root is probably good enough for most people when using SBo SlackBuilds.

Don't get me wrong I am a fan of fakeroot but I was not trying to claim it was the be all and end all.


All times are GMT -5. The time now is 09:45 PM.