Loading
Home ›
Commandline 101: su and sudo
Trending Topics
| You Need A Budget | Feb 10, 2012 |
| The Linux powered LAN Gaming House | Feb 08, 2012 |
| Creating a vDSO: the Colonel's Other Chicken | Feb 06, 2012 |
| Your CMS Is Not Your Web Site | Feb 01, 2012 |
| Casper, the Friendly (and Persistent) Ghost | Jan 31, 2012 |
| Razor-qt 0.4 - Qt based Desktop Environment | Jan 30, 2012 |
- Fun with ethtool
- Parallel Programming with NVIDIA CUDA
- Readers' Choice Awards 2011
- 100% disappointed with the decision to go all digital.
- Linux-Based X Terminals with XDMCP
- Validate an E-Mail Address with PHP, the Right Way
- You Need A Budget
- The Linux powered LAN Gaming House
- Why Python?
- Python for Android
- Employment Posters
2 hours 59 min ago - Sure the best distro is
4 hours 20 min ago - BeOS was the best
7 hours 3 min ago - I use Wireshark on a daily
11 hours 34 min ago - buena información
16 hours 40 min ago - One important "bucket" that I didn't note (désolé si qqun deja d
17 hours 41 min ago - Gnome3 is such a POS. No one
1 day 3 hours ago - Gnome 3 is the biggest POS
1 day 3 hours ago - I didn't knew this thing by
1 day 9 hours ago - Author's reply
1 day 12 hours ago





Comments
su
su doesn't mean super user. su means switch user or substitute user. Since most people use su only for root and since sudo means super user do, it's assumed su mean super user. But you can use su to run as any user, like $ su - bob. If you don't specify a user it assumes root.
What's the use of setting root password ?
Ok, it's shorter to type
#su -
than
#sudo -s
but it's only 3 characters more, in both case you type a password.
And by setting root a password, you need to remember one more (what's the use to set the same password of your current user?).
Which (root password) can be break while before I don't think it could be.
Maybe the best way to get root access is (I type sudo -s.... I can use a keyboard ;)) :
alias s="sudo -s"
type s (yahooo... you save one character lazy boy ;)) and type your current user password.
To my mind, setting a password to root is breaking a security concept of Ubuntu system (as you'd be able to break root password).
Thomas.
Not to be nit-picky, but....
I love Shawn's tech tips. Much better than the droll ones from "the other guy" (I forget his name...lol).
However, one correction...Shawn said su means "Super User". It actually means Substitute User. Allowing you substitute the current uid and gid with that of "USER":
SU(1) User Commands SU(1)
NAME
su - run a shell with substitute user and group IDs
SYNOPSIS
su [OPTION]... [-] [USER [ARG]...]
With no parameters, it defaults to root, but I use it quite often to substitute as a user if I need to do some things on behalf of the user. Of course, the most common use is to become root.
Cheers!
Other Ways
A couple of other ways to quickly get "superpowers." (Hey, wouldn't THAT be a cool nickname for Shawn Powers???"
The Ubuntu menu system includes "Root Terminal," although you need to enable it with Edit Menus, if I recall correctly.
In my installations I always create a launcher in the menus for "Root Nautilus" by using the command "gksudo nautilus". I very seldom resort to using this in the interest of system safety, but sometimes it's the quickest way to get something done.
My preferences for Nautilus include single click to select and small (67%) icons, so I leave root Nautilus set to double click and 100% size icons just to serve as a reminder that I'm operating as root and that I need to be extra careful!
another
sudo -s ?
An easier way....
Use sudo -i for an interactive root shell.
two other commands that
two other commands that accomplish the same thing are sudo su and sudo bash.
i added an alias to my bashrc file so that typing su actually executes one of those commands.
Huh.
Well look at that. I guess you can call me "LongForm McGee", since I apparently like to do things the long way.
Actually, maybe don't call me that. It'd be a weird nickname. :)
(Thanks for the tip though!)
Shawn Powers is an Associate Editor for Linux Journal. You might find him chatting on the IRC channel, or Twitter
Nice video this
Well Shawn I like your columns in LJ and the best thing I've done this month so far apart from recompiling my kernel and downloading Ubuntu 9.04 (for testing and tweaking, what else!) is adding LJ on twitter. Keep on the good work.