Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-26-2012, 12:31 PM   #1
Registered: Feb 2006
Distribution: FC 15
Posts: 42

Rep: Reputation: 2
root pw

Macs and Ubuntu (I think) do not allow you to su -, you have to use sudo. Apparently this is a good thing.
You can use sudo passwd root to set a root pw and that allows you to do su -

My questions are:

How do you remove the ability to su - so you go back to having to do sudo all the time?

Why is it viewed as a "bad thing" to have su - enabled?
Old 01-26-2012, 12:40 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,939
Blog Entries: 14

Rep: Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160
su is a binary (e.g. a file in /bin/su on some systems). You could move this binary to something like /bin/secret_su or a cryptic name then create a wrapper script named su in its place. In the wrapper script you check to see see if the su command was called by sudo and if so you have it execute secret_su - if not you issue a message and exit something like:
Error: You must use 'sudo su' rather than just 'su'.

The reason why use of sudo is considered (by some) to be better is that sudo logs everything it does so theoretically you can see who did what on a system. If this is important to you then you should insure you're sending logging to another server to prevent someone who became root from simply deleting the logs to hide their tracks. In many distros "sudo su" is NOT required.

Last edited by MensaWater; 01-26-2012 at 12:42 PM.
1 members found this post helpful.
Old 01-26-2012, 12:53 PM   #3
Senior Member
Registered: Feb 2009
Posts: 4,194

Rep: Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182
First of all, Ubuntu "allows" you to do anything you want. Some users prefer sudo and some users prefer su. Linux is all about choice and freedom.

Second if you have enabled the root account, but change your mind and want to lock it, so that sudo is the only method:

sudo passwd -dl root
For more info:
1 members found this post helpful.
Old 01-26-2012, 03:12 PM   #4
Registered: Feb 2006
Distribution: FC 15
Posts: 42

Original Poster
Rep: Reputation: 2

Hey thanks. BTW It wasn't a sleight against ubuntu, it is just because the default setting on an ubuntu server I used was like a mac in having the su - disabled.
Thanks for the help.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] how can i remount root filesystem as read/write after modify readonly-root file jcwkyl Linux - Newbie 3 12-21-2010 10:40 PM
How can I have a script owned as root and run as root by a user: setuid? stickey bit? abefroman Linux - Newbie 9 04-19-2008 05:15 PM
why lftp command run failed when user isn't root, but ok when logining as root steven_yu Linux - Software 0 06-06-2007 08:36 PM
RHEL3 Mounting USB after reboot and between reboots: root and non-root users Luis Nunes Linux - Hardware 0 07-20-2005 08:32 AM
root files: create as root:root or root:wheel? pcass Linux - Security 1 02-07-2004 04:14 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:49 AM.

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