LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-06-2008, 05:04 AM   #1
properganda
Member
 
Registered: Jan 2008
Posts: 43

Rep: Reputation: 15
Problem using "su" command


I'm trying to use a non-root username to login to my server using ssh, but when I log in and then try to switch to super-user I get this:



user1@properganda ~ $ su root
su: Authentication failure
Sorry.

I've had a look at chmodding the "su" command to 755 etc, but that doesn't solve the issue and I don't beleive it should be necessary. Any ideas?
 
Old 02-06-2008, 05:09 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
What system is this? If Ubuntu, it does not allow root login (actually the root account is locked) and you should use sudo instead. Also, have you been prompted for password?
 
Old 02-06-2008, 05:19 AM   #3
properganda
Member
 
Registered: Jan 2008
Posts: 43

Original Poster
Rep: Reputation: 15
It's gentoo.

Root login is allowed but to harden security I want to disallow it. I thought "sudo"
was only a debian/ubuntu thing, but will give sudo a try.
 
Old 02-06-2008, 05:34 AM   #4
rpgraca
LQ Newbie
 
Registered: Feb 2008
Location: Portugal
Distribution: Debian
Posts: 26

Rep: Reputation: 0
In gentoo, I think the user must be in the 'wheel' group do have root access.
 
Old 02-06-2008, 05:40 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Also, check if the suid bit of /bin/su is set:
Code:
ls -l /bin/su
-rwsr-xr-x 1 root root 28336 Apr 17  2007 /bin/su
 
Old 02-06-2008, 06:20 AM   #6
properganda
Member
 
Registered: Jan 2008
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks for the help guys, I ran this line as root:

gpasswd -a user1 wheel

and then logged in as user1 and ran the su command but still get the authentication failure.
 
Old 02-06-2008, 06:21 AM   #7
properganda
Member
 
Registered: Jan 2008
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by colucix View Post
Also, check if the suid bit of /bin/su is set:
Code:
ls -l /bin/su
-rwsr-xr-x 1 root root 28336 Apr 17  2007 /bin/su
what do you mean by this?
 
Old 02-06-2008, 06:25 AM   #8
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
he is pointing out the lower case 's' where you would expect an x (-rws instead of -rwx)
which would mean that the bin is executed as the user owning the file, not the user calling the command
a must for su
 
Old 02-06-2008, 06:39 AM   #9
properganda
Member
 
Registered: Jan 2008
Posts: 43

Original Poster
Rep: Reputation: 15
thanks, well I've got

"-rwx--x--x 1 root root 25084 2008-01-17 19:23 su"

So that would seem to be ok.
 
Old 02-06-2008, 06:40 AM   #10
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Thanks Nathanael, I should have used a more visible color:
Code:
-rwsr-xr-x 1 root root 28336 Apr 17  2007 /bin/su
If eventually it is not set, use
Code:
chmod +s /bin/su
Edit: just seen your last post. No, it should be as above - as Nathanael explained. Try the chmod command, then try su again.

Last edited by colucix; 02-06-2008 at 06:41 AM.
 
Old 02-06-2008, 06:43 AM   #11
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
Quote:
Originally Posted by colucix View Post
Edit: just seen your last post. No, it should be as above - as Nathanael explained. Try the chmod command, then try su again.
for the chmod to work you need to be root, so i would either login directly as root or use sudo to get there, as you will lack permissions to set the premission pit on that file otherwise.

looks to me like you muddled up a little with your chmod experiment you mentioned in one of the earlier posts....
 
  


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
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
Make "ls" command show colors without "--color=always" switch SharpyWarpy Linux - General 4 07-16-2007 11:00 PM
"stalled" problem in " scp" command gentleshark Linux - Software 1 08-30-2005 02:08 AM
"stalled" problem in " scp" command gentleshark Linux - Networking 1 08-29-2005 12:41 PM
Tiny Sofa 2.0 - I thought "halt", "reboot" were only root command ?? sorcerer Linux - Distributions 1 08-21-2004 03:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:22 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