What’s the Difference Between Sudo & Su?
2013-01-03 10:00
501 查看
Sudo and su are two different ways to gain root privileges. Each functions in a different way, and different Linux distributions use different configurations by default.
permissions – for example, they can’t install software or write to system directories.
To do something that requires these permissions, you’ll have to acquire them with su or sudo.
execute the su bob command, you’ll be prompted to enter Bob’s password and the shell will switch to Bob’s user account.
Once you’re done running commands in the root shell, you should type exit to leave the root shell and go back to limited-privileges mode.
Sudo runs a single command with root privileges. When you execute sudo command, the system prompts you for your current user account’s password before running
command as the root user. By default, Ubuntu remembers the password for fifteen minutes and won’t ask for a password again until the fifteen minutes are up.
The Root User
Both su and sudo are used to run commands with root permissions. The root user is basically equivalent to the administrator user on Windows – the root user has maximum permissions and can do anything to the system. Normal users on Linux run with reducedpermissions – for example, they can’t install software or write to system directories.
To do something that requires these permissions, you’ll have to acquire them with su or sudo.
Su vs. Sudo
The su command switches to the super user – or root user – when you execute it with no additional options. You’ll have to enter the root account’s password. This isn’t all the su command does, though – you can use it to switch to any user account. If youexecute the su bob command, you’ll be prompted to enter Bob’s password and the shell will switch to Bob’s user account.
Once you’re done running commands in the root shell, you should type exit to leave the root shell and go back to limited-privileges mode.
Sudo runs a single command with root privileges. When you execute sudo command, the system prompts you for your current user account’s password before running
command as the root user. By default, Ubuntu remembers the password for fifteen minutes and won’t ask for a password again until the fifteen minutes are up.
相关文章推荐
- What is the difference between a = a * (2^3) and a = a << 3?
- What is the difference between angle bracket < > and double quotes " " while including header files
- What's the difference between a URI and a URL?
- CareerCup What is the difference between a computers heap and it's stack?
- What is the difference between '/n' and '/r/n'? /n /r/n的区别是什么
- What are the differences between shell , console & terminal?
- What is the difference between primary & secondary storage device?
- What’s the difference between <system.web> and <system.webServer>?
- What’s the difference between alignment, de novo assembly, and map to reference
- what is the difference between ng-if and ng-show/ng-hide
- What is the difference between Binding and TemplateBinding?
- What is the difference between netty(io.netty.*) and jboss netty(org.jboss.netty.*)
- What is the difference between initWithCoder:, initWithNibName:, and awakeFromNib?
- What is the difference between “setup” and “install” based on computer programs?
- The main difference between Java & C++(转载)
- Language Constructs和Functions的区别(The Difference Between Functions & Language Constructs)
- Q: What is the difference between protocol stacks and profiles?蓝牙协议栈和profile的区别
- What are the differences between numpy arrays and matrices
- What are the difference between DDL, DML and DCL commands?
- Multi-thread: What is the difference between OpenMP and MPI