9

In my new Gentoo installation, su doesn't work as my non-root user: After entering the correct password I get the message "su: Permission denied". What could be causing this? I have already tried reinstalling the package containng /bin/su.

EDIT: sudo works.

  • Are you able to su from root to another user? – michas Jan 20 '13 at 3:15
14

I solved the same problem by editing

 /etc/pam.d/su

and commenting out this line:

auth       required     pam_wheel.so use_uid

It requires users to be in the wheel group to be able to switch user. User switching as non-root works again when this pam module is disabled for su.

The alternative is to add the user to the wheel group, of course (gentoo recommends this)

  • I was going to update your other questions/answers since this one was so good, you only have one answer over the last 5 years? You need to up those numbers bro, those are rookie numbers. – Eric Leschinski Jul 7 '18 at 12:25
8

There could be many problems. Check some of these items, using the hypothetical user, erik:

  1. Is erik a member of the wheel group (groups)?
  2. Are you providing the root password? (And not the password for erik)
  3. Does /bin/su have these privileges: rwsr-xr-x (Is it setuid root? ls -l /bin/su)
  4. Can you log in as root via the console?
  5. Have you looked at the logs for a clue in an error message?
  6. Have you turned on grsecurity in the kernel?
  7. Did it ever work? If so, when did it break?
  8. What happens if erik does a sudo su -?
2

There could be many reasons. It's very likely that the reason appears in the system logs. Look in /var/log for files that got modified at the time of an su attempt (the file name depends on your syslog configuration). If you have trouble interpreting log entries, copy-paste them into your question.

0

I compiled shadow in the course of building Linux From Scratch 8.4, and I could login as root or an unprivileged user, but couldn't su from unprivileged user to root, as for Erik above. It turned out the su binary was owned by my unprivileged user. It worked after I chowned the su binary to root, and did 'chmod u+s' on the su binary.

  • That's good to know, but unlikely to be the original problem, as it was installed from a package and a different answer was already accepted. – RalfFriedl Apr 14 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.