LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-15-2005, 05:22 PM   #1
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Rep: Reputation: 15
su command refuses to work


Heya,

After booting up Linux and logging in as lithium, I realised something was wrong. A few minutes later, I discovered my user account had no ID, home dir or login shell. I used KUser (with KDE 3.4.0) and recreated the account. All worked.

Then, I used KUser to change the root login shell to /bin/zsh. Big mistake. KUser destroyed root (or probably me using KUser destroyed root). Anyway, after getting a friend to help me boot from the Slackware 10.1 CD and correct the /etc/passwd file, I could login as root. Now, if I run su as a normal user, even if I provide the correct password, I get a "sorry". If I run su as root, it proceeds to the next line. The permissions for /bin/su are -

User: Read/Write/Execute
Owner: Read/Execute
Group: Read/Execute

setuid
setgid

Owner: root
Group: bin

I've checked /etc/groups and I am a member of wheel. Could it be a problem with root, maybe root isn't members of the groups it is needed to be in? I've tried changing the root password then su'ing to no avail. I've tried everything I can think of and I really don't want to have to reinstall. Your advice would be greatly appreciated.
 
Old 04-15-2005, 10:03 PM   #2
buaku
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2 (2.4.31)
Posts: 119

Rep: Reputation: 15
hrmm my perms for /bin/su are -rws--x--x if that helps
And my local user isn't a member of wheel...just root
 
Old 04-15-2005, 10:18 PM   #3
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
I would check the permissions for /etc/passwd and /etc/shadow files also because su depends on this to make check for root, in my system:
Code:
-rw-r--r--  1 root root 758 2004-10-04 06:03 /etc/passwd
-rw-r-----  1 root shadow 624 2004-10-04 06:03 /etc/shadow
-rws--x--x  1 root bin 35K 2004-06-21 16:20 /bin/su
Just in case, my root line at /etc/passwd:
Code:
root:x:0:0::/root:/bin/bash

Last edited by gbonvehi; 04-15-2005 at 10:20 PM.
 
Old 04-16-2005, 06:29 AM   #4
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Original Poster
Rep: Reputation: 15
Hey,

Thanks for your replies. I've checked the files, and they all match the permissions you describe apart from su. su is -rwx--x--x, but I'm stuck on getting it to -rws--x--x. What's the numeric value of -rws--x--x? I hope that the problem is with getting the permissions correct, but I'm stuck on the -rws--x--x bit.

Update: I was looking in /bin and noticed "sulogin", which links to /sbin/sulogin. The permissions for sulogin in sbin are -rwxr-xr-x. Could this, and the incorrect permissions for su, be causing the problem?

What does -rws--x--x equate to in numerical values, and does it represent setuid or setgid? Your help is appreciated.

Last edited by lithiumfx; 04-16-2005 at 10:53 AM.
 
Old 04-16-2005, 11:18 AM   #5
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Original Poster
Rep: Reputation: 15
Excuse my stupidity!

I've worked out how to, and have set, /bin/su and /sbin/sulogin to -rws--x--x. However, I still can't su. All other files have matching permissions to the permissions you described, however, /sbin/sulogin remains unconfirmed. Could somebody please tell me what the permissions for /sbin/sulogin should be, or if there is anything else I can try to fix this problem?
 
Old 04-16-2005, 02:56 PM   #6
buaku
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2 (2.4.31)
Posts: 119

Rep: Reputation: 15
here's my /sbin/sulogin
-rwxr-xr-x 1 root bin 15608 2004-05-20 20:01 /sbin/sulogin

Here's a little story....at work something went horribly wrong w/ a recursive chown, a user had a link to /. in his dir. Why....no freakin clue....but the sysadmin chown'd his whole dir to that user and then it got loose in / and starting changing ownership in /etc /usr and the like. All that mess made su not work from anywhere, and it was impossible to log in.
Good thing there was another root console open. But the sysadmin went through and fixed some of the perms. And i think he had to make sure the group password and shadow files had the right ownership. Once those were changed he could at least login as root, but su was still broke. He ended up gettin on another machine and going through the dirs and manually chown'ing everything back for a temp fix. The real solution was just to reinstall everything.

So, you might be better off backing important stuff up and doing a reinstall. Especially since you might not exactly know what other things could have changed.
 
Old 04-16-2005, 03:32 PM   #7
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Original Poster
Rep: Reputation: 15
Hey,

Thanks again for your help. I set the /sbin/sulogin file to match that, and still no joy. I was advised, as I use SWareT, to try swaret --reinstall shadow, and I did, yet again to no avail.

I seriously considered reinstalling, but as I downloading a Sunday afternoon's worth of updates, and have no other problems with my system, I don't see why I can't fix this. I think it's probably a permissions problem, but after reading through the su man page I noticed that it talks about /etc/login.defs which in turn has a lot of references to su. Lines like this caught my attention -

Code:
#
# Enable "syslog" logging of su activity - in addition to sulog file logging.
# SYSLOG_SG_ENAB does the same for newgrp and sg.
#
SYSLOG_SU_ENAB		yes
SYSLOG_SG_ENAB		yes

#
# If defined, the presence of this value in an /etc/passwd "shell" field will
# disable logins for that user, although "su" will still be allowed.
#
# XXX this does not seem to be implemented yet...  --marekm
# no, it was implemented but I ripped it out ;-) -- jfh
NOLOGIN_STR	NOLOGIN

#
# If "yes", the user must be listed as a member of the first gid 0 group
# in /etc/group (called "root" on most Linux systems) to be able to "su"
# to uid 0 accounts.  If the group doesn't exist or is empty, no one
# will be able to "su" to uid 0.
#
SU_WHEEL_ONLY	no
The paragraph -

Quote:
The current environment is passed to the new shell. The
value of $PATH is reset to /bin:/usr/bin for normal users,
or /sbin:/bin:/usr/sbin:/usr/bin for the super user. This
may be changed with the ENV_PATH and ENV_SUPATH defini_
tions in /etc/login.defs.
Also grabbed my attention. Especially the /sbin:/bin:/usr/sbin:/usr/bin for the super user bit. The login shell for root is set to /bin/zsh, I'm not really sure if this is wrong (should it be /sbin?).

Also -

Quote:
FILES
/etc/passwd - user account information
/etc/shadow - encrypted passwords and age information
$HOME/.profile - initialization script for default shell
What does .profile represent? It isn't present in any of the home dirs, even for root.

Oh, and one final thing, after setting /etc/suauth to bypass password authentication, look what I get -

Quote:
lithium@lithbox:.% su
Password authentication bypassed.
Sorry.
Surely there has to be a way to fix this. Your help is greatly appreciated.

Last edited by lithiumfx; 04-16-2005 at 03:33 PM.
 
Old 04-16-2005, 03:51 PM   #8
buaku
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2 (2.4.31)
Posts: 119

Rep: Reputation: 15
Those lines in your login.defs look like mine, so that's probably ok.

.profile is usually used with bash. It sets things up when you login.

You could try setting your shell back to bash for root and see if that gets you anywhere.

Can you login as root ok?
 
Old 04-16-2005, 03:57 PM   #9
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Original Poster
Rep: Reputation: 15
Just tried setting the login shell to bash, still no. I can log in and use root no problems, and I tried su'ing to root from root and no errors there. If I do su lithium, su root I get problems. One thing I have read about is that in passwd, the UID number can be a problem. Like mine for example, it is lithium:x:500:100, I read there should be no x there (although every account has an x). Here is my entire passwd file, maybe it is a user account issue with lithium?

Quote:
root:x:0:0::/root:/bin/zsh
bin:x:1:1:bin:/bin:
daemon:x:2:2:daemon:/sbin:
adm:x:3:4:adm:/var/log:
lp:x:4:7:lp:/var/spool/lpd:
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/:
news:x:9:13:news:/usr/lib/news:
uucp:x:10:14:uucp:/var/spool/uucppublic:
operator:x:11:0perator:/root:/bin/bash
games:x:12:100:games:/usr/games:
ftp:x:14:50::/home/ftp:
smmsp:x:25:25:smmsp:/var/spool/clientmqueue:
mysql:x:27:27:MySQL:/var/lib/mysql:/bin/bash
rpc:x:32:32:RPC portmap user:/:/bin/false
sshd:x:33:33:sshd:/:
gdm:x:42:42:GDM:/var/state/gdm:/bin/bash
pop:x:90:90:POP:/:
nobody:x:99:99:nobody:/:
lithium:x:500:100::/home/lithium:/bin/zsh
 
Old 04-16-2005, 04:07 PM   #10
buaku
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2 (2.4.31)
Posts: 119

Rep: Reputation: 15
The x is where the password normally goes, but the encrypted ones are in the shadow file. So the x is ok.

My user looks like..
buaku:x:1000:100:,,,:/home/buaku:/bin/bash
Not sure what all the ","s mean though.

Have you tried creating another user not using KUser and trying su from that account?

I googled for "Kuser root problem" and it seems at one point Kuser did some odd things to different account.
 
Old 04-16-2005, 04:22 PM   #11
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Original Poster
Rep: Reputation: 15
Hey,

Just created a new user, and still no. However, I can su from root to lithium to the test account to lithium, but not to root. It seems the root account is the problem. Now, shoot me if what I am about to ask is suicide, but -

Can I recreate the root account from inside Linux, or by booting off the CD?

su doesn't seem to be broken, but the root account seems to be having problems. Either I recreate root, or there could be something I need to change (root's groups perhaps?). Thanks for the help so far!
 
Old 04-16-2005, 04:34 PM   #12
buaku
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2 (2.4.31)
Posts: 119

Rep: Reputation: 15
Let me see if I understand this... As root you can su to anyone, and as a user you can su to another user but not root?

Not too sure how you'd recreate root.
I guess you'd have to redo /root and the passwd group, shadow, and group files. Maybe if you reset root's password. You can probably do that by wiping out the string between the first and second colons in the shadow file. That might be dangerous tho, not sure what bad things could happen.

Here's all the groups my root is in
#> groups
root bin daemon sys adm disk wheel floppy

Another thought I had was if you have a shadow- and passwd- file, see how they compare to the real ones. I think the - ones are backups. I have no clue where mine came from though, hehe.

Another idea I had was, what if you use su with the -
su -
instead of just su

Also what happens if you like ssh to your own machine and try to login as root?

I'm not too sure what could be wrong with your su, so I'm just trying to think of things to try that could lend a clue to what's going on.

I guess you could boot off the cd and see what the passwd and group and shadow files look like there. Maybe that will tell you something too.
 
Old 04-16-2005, 04:57 PM   #13
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Original Poster
Rep: Reputation: 15
Hmm,

Here is an example of what I can do with su -

Quote:
root@lithbox:~# su lithium
lithium@lithbox:.% su test
Password:
%n@%m:%~%# su lithium
Password:
lithium@lithbox:.% su
Password:
Sorry.
lithium@lithbox:.% su
Password:
Sorry.
lithium@lithbox:.% su -
Password:
Sorry.
lithium@lithbox:.% su -
Password:
Sorry.
lithium@lithbox:.% exit
%n@%m:%~%# exit
exit
lithium@lithbox:.% exit
root@lithbox:~#
I also tried su - in that, and that didn't work. I'm sure I am typing the password correct by the way. I removed root's password in shadow, ran passwd and changed it. Again, nothing. I do have shadow-, passwd-, group-, gshadow-, and they are all identical. All mine were made right before KUser trashed everything (22:53 yesterday) .

I'm unsure on how to use ssh (I know I disabled the startup script for it), but I'll try. I'm about to boot off the CD now.

Now, I know that it would be easier to reinstall. That root being the problem account is bad, but think about it. root is just like another account, but in a special group and with the UID of 0. Therefore, it can be recreated and it isn't the end so long as you can boot from a CD. Or am I talking rubbish?

I had a similar problem, which was fixed by deleting and recreating my user account (but not the home directory). The problem is, with root, can I simply user KUser to delete and recreate the account? KUser creates fine, just it eats anything you edit. I'll try and recreate root now, wish me luck!
 
Old 04-16-2005, 05:10 PM   #14
buaku
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2 (2.4.31)
Posts: 119

Rep: Reputation: 15
Don't worry about the ssh thing then if you disabled it.
You should be able to use rsh instead.

Yeah your logic sounds right about root just being another account.

Good luck w/ that and let us know how it turns out!.

Worst case you can always reinstall everything.
 
Old 04-16-2005, 05:14 PM   #15
lithiumfx
Member
 
Registered: Apr 2005
Distribution: CRUX 2.2
Posts: 38

Original Poster
Rep: Reputation: 15
Great news!

I deleted root in KUser (but not /root), recreated the account with UID 0, matched your groups for root and -

Quote:
lithium@lithbox:~% su
Password:
root@lithbox:/home/lithium#
So, after several posts, several curses, several fits of rage, the simplest thing worked! Thanks buaku for your help, and remember that KUser makes accounts, but doesn't edit them!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gimp refuses to work JeTa Linux - Software 1 06-15-2005 12:45 PM
Apt-get refuses to work now jon_k Linux - Software 1 03-25-2005 02:55 PM
yum refuses to work arjun_sh Linux - Newbie 4 03-19-2005 06:52 AM
Audio refuses to work :( DaBlade Linux - Hardware 47 10-10-2004 05:31 PM
XV refuses to work snooo Linux - Software 14 08-12-2004 06:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration