What are the differences between “su”, “sudo -s”, “sudo -i”, “sudo su”?
I already read it from manual but I can't see difference..
su
- change user ID or become superuser
sudo -s [command]
The -s
(shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5). If a
command is specified, it is passed to the shell for execution. Otherwise, an interactive shell is executed.
sudo -i
disappear description in manual
sudo su
add a comment |
I already read it from manual but I can't see difference..
su
- change user ID or become superuser
sudo -s [command]
The -s
(shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5). If a
command is specified, it is passed to the shell for execution. Otherwise, an interactive shell is executed.
sudo -i
disappear description in manual
sudo su
6
Also, do not usesu user
to login from untrusted shells, butsu - user
. See unix.stackexchange.com/q/7013/8250
– Lekensteyn
Oct 22 '11 at 8:45
@Lekensteyn wow, great example. thx for the LOL :)
– törzsmókus
Jan 30 '15 at 15:11
1
always remember the old commandment: thou shalt not claim root's name in vain!
– törzsmókus
Jan 30 '15 at 15:11
Not sayingsudo -i
is bad, but you can certainly f*** things up using it
– Kolob Canyon
Nov 15 '16 at 22:06
Near-duplicate: askubuntu.com/questions/376199/…
– Reinier Post
Jun 6 '17 at 9:59
add a comment |
I already read it from manual but I can't see difference..
su
- change user ID or become superuser
sudo -s [command]
The -s
(shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5). If a
command is specified, it is passed to the shell for execution. Otherwise, an interactive shell is executed.
sudo -i
disappear description in manual
sudo su
I already read it from manual but I can't see difference..
su
- change user ID or become superuser
sudo -s [command]
The -s
(shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5). If a
command is specified, it is passed to the shell for execution. Otherwise, an interactive shell is executed.
sudo -i
disappear description in manual
sudo su
sudo su
edited May 8 '15 at 7:57
muru
1
1
asked Oct 22 '11 at 6:11
Smile.HunterSmile.Hunter
2,96092530
2,96092530
6
Also, do not usesu user
to login from untrusted shells, butsu - user
. See unix.stackexchange.com/q/7013/8250
– Lekensteyn
Oct 22 '11 at 8:45
@Lekensteyn wow, great example. thx for the LOL :)
– törzsmókus
Jan 30 '15 at 15:11
1
always remember the old commandment: thou shalt not claim root's name in vain!
– törzsmókus
Jan 30 '15 at 15:11
Not sayingsudo -i
is bad, but you can certainly f*** things up using it
– Kolob Canyon
Nov 15 '16 at 22:06
Near-duplicate: askubuntu.com/questions/376199/…
– Reinier Post
Jun 6 '17 at 9:59
add a comment |
6
Also, do not usesu user
to login from untrusted shells, butsu - user
. See unix.stackexchange.com/q/7013/8250
– Lekensteyn
Oct 22 '11 at 8:45
@Lekensteyn wow, great example. thx for the LOL :)
– törzsmókus
Jan 30 '15 at 15:11
1
always remember the old commandment: thou shalt not claim root's name in vain!
– törzsmókus
Jan 30 '15 at 15:11
Not sayingsudo -i
is bad, but you can certainly f*** things up using it
– Kolob Canyon
Nov 15 '16 at 22:06
Near-duplicate: askubuntu.com/questions/376199/…
– Reinier Post
Jun 6 '17 at 9:59
6
6
Also, do not use
su user
to login from untrusted shells, but su - user
. See unix.stackexchange.com/q/7013/8250– Lekensteyn
Oct 22 '11 at 8:45
Also, do not use
su user
to login from untrusted shells, but su - user
. See unix.stackexchange.com/q/7013/8250– Lekensteyn
Oct 22 '11 at 8:45
@Lekensteyn wow, great example. thx for the LOL :)
– törzsmókus
Jan 30 '15 at 15:11
@Lekensteyn wow, great example. thx for the LOL :)
– törzsmókus
Jan 30 '15 at 15:11
1
1
always remember the old commandment: thou shalt not claim root's name in vain!
– törzsmókus
Jan 30 '15 at 15:11
always remember the old commandment: thou shalt not claim root's name in vain!
– törzsmókus
Jan 30 '15 at 15:11
Not saying
sudo -i
is bad, but you can certainly f*** things up using it– Kolob Canyon
Nov 15 '16 at 22:06
Not saying
sudo -i
is bad, but you can certainly f*** things up using it– Kolob Canyon
Nov 15 '16 at 22:06
Near-duplicate: askubuntu.com/questions/376199/…
– Reinier Post
Jun 6 '17 at 9:59
Near-duplicate: askubuntu.com/questions/376199/…
– Reinier Post
Jun 6 '17 at 9:59
add a comment |
5 Answers
5
active
oldest
votes
The main difference between these commands is in the way they restrict access to their functions.
su
(which means "substitute user" or "switch user") - does exactly that, it starts another shell instance with privileges of the target user. To ensure you have the rights to do that, it asks you for the password of the target user. So, to become root, you need to know root password. If there are several users on your machine who need to run commands as root, they all need to know root password - note that it'll be the same password. If you need to revoke admin permissions from one of the users, you need to change root password and tell it only to those people who need to keep access - messy.
sudo
(hmm... what's the mnemonic? Super-User-DO?) is completely different. It uses a config file (/etc/sudoers) which lists which users have rights to specific actions (run commands as root, etc.) When invoked, it asks for the password of the user who started it - to ensure the person at the terminal is really the same "joe" who's listed in /etc/sudoers
. To revoke admin privileges from a person, you just need to edit the config file (or remove the user from a group which is listed in that config). This results in much cleaner management of privileges.
As a result of this, in many Debian-based systems root
user has no password set - i.e. it's not possible to login as root directly.
Also, /etc/sudoers
allows to specify some additional options - i.e. user X is only able to run program Y etc.
The often-used sudo su
combination works as follows: first sudo
asks you for your password, and, if you're allowed to do so, invokes the next command (su
) as a super-user. Because su
is invoked by root
, it does not require you to enter the target user's password. So, sudo su
allows you to open a shell as another user (including root), if you're allowed super-user access by the /etc/sudoers
file.
2
I've never seensu
as "switch user", but always as superuser; the default behavior without another's user name (though it makes sense). From wikipedia : "The su command, also referred to as super user[1] as early as 1974, has also been called "substitute user", "spoof user" or "set user" because it allows changing the account associated with the current terminal (window)."
– dr jimbob
Oct 22 '11 at 13:47
4
@dr jimbob: you're right, but I'm finding that "switch user" is kinda describes better what it does - though historically it stands for "super user". I'm also delighted to find that the wikipedia article is very similar to my answer - I never saw the article before :)
– Sergey
Oct 22 '11 at 20:33
11
The official meaning of "su" is "substitute user". See: "man su".
– Angel O'Sphere
Nov 26 '13 at 13:02
1
@AngelO'Sphere: Interestingly, Ubuntu's manpage does not mention "substitute" at all. The manpage at gnu.org (gnu.org/software/coreutils/manual/html_node/su-invocation.html) does indeed say "su: Run a command with substitute user and group ID". I think gnu.org is a canonical source :)
– Sergey
Nov 26 '13 at 20:25
1
What aboutsudo su
?
– Kaz Wolfe
Oct 15 '14 at 8:14
|
show 11 more comments
sudo
lets you run commands in your own user account with root privileges. su
lets you switch user so that you're actually logged in as root.
sudo -s
runs a shell with root privileges. sudo -i
also acquires the root user's environment.
To see the difference between su
and sudo -s
, do cd ~
and then pwd
after each of them. In the first case, you'll be in root's home directory, because you're root. In the second case, you'll be in your own home directory, because you're yourself with root privileges.
There's more discussion of this exact question here.
19
"you're yourself with root privileges" is not what's actually happening :) Actually, it's not possible to be "yourself with root privileges" - either you're root or you're yourself. Try typing whoami in both cases. The fact thatcd ~
results are different is a result of sudo -s not setting $HOME environment variable.
– Sergey
Oct 22 '11 at 7:28
1
@Sergey, whoami it says are 'root' because you are running the 'whoami' cmd as though you sudoed it, so temporarily (for the duration of that command) you appear to be the root user, but you might still not have full root access according to the sudoers file.
– Octopus
Feb 6 '15 at 22:15
1
@Octopus: what I was trying to say is that in Unix, a process can only have one UID, and that UID determines the permissions of the process. You can't be "yourself with root privileges", a program either runs with your UID or with root's UID (0).
– Sergey
Feb 6 '15 at 22:24
5
Regarding "you might still not have full root access according to the sudoers file": thesudoers
file controls who can run which command as another user, but that happens before the command is executed. However, once you were allowed to start a process as, say, root - the running process has root's UID and has a full access to the system, there's no way for sudo to restrict that. Again, you're always either yourself or root, there's no "half-n-half". So, ifsudoers
file allows you to run shell as root - permissions in that shell would be indistinguishable from a "normal" root shell.
– Sergey
Feb 6 '15 at 22:32
add a comment |
This answer is a dupe of my answer on a dupe of this question, put here on the canonical answer so that people can find it!
The major difference between sudo -i
and sudo -s
is:
sudo -i
gives you the root environment, i.e. your~/.bashrc
is ignored.
sudo -s
gives you the user's environment, so your~/.bashrc
is respected.
Here is an example, you can see that I have an application lsl
in my ~/.bin/
directory which is accessible via sudo -s
but not accessible with sudo -i
. Note also that the Bash prompt changes as will with sudo -i
but not with sudo -s
:
dotancohen@melancholy:~$ ls .bin
lsl
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ sudo -i
root@melancholy:~# which lsl
root@melancholy:~# exit
logout
dotancohen@melancholy:~$ sudo -s
Sourced .bashrc
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ exit
exit
Though sudo -s
is convenient for giving you the environment that you are familiar with, I recommend the use of sudo -i
for two reasons:
- The visual reminder that you are in a 'root' session.
- The root environment is far less likely to be poisoned with malware, such as a rogue line in
.bashrc
.
I noticed sudo -s doesnt seem to process /etc/profile , or anything I have in /etc/profile.d/ .. any idea why?
– meffect
Feb 23 '17 at 5:21
@dotancohen - What do you mean bysudo -s
provides an environment that a user is familiar with?
– Motivated
Jan 16 at 19:18
@dotancohen - The command sudo -s already provides visual cues so i'm curios as to why sudo -i is a better option.
– Motivated
Jan 16 at 19:28
add a comment |
su
asks for the password of the user "root".
sudo
asks for your own password (and also checks if you're allowed to run commands as root, which is configured through /etc/sudoers
-- by default all user accounts that belong to the "admin" or "sudo" groups are allowed to use sudo).
sudo -s
launches a shell as root, but doesn't change your working directory. sudo -i
simulates a login into the root account: your working directory will be /root
, and root's .profile
etc. will be sourced as if on login.
1
to make the answer more complete:sudo -s
is almost equal tosu
($HOME is different) andsudo -i
is equal tosu -
– DJCrashdummy
Jul 29 '17 at 0:58
@DJCrashdummy - Why do you say almost equal to? What is different?
– Motivated
Jan 17 at 4:38
add a comment |
In Ubuntu or a related system, I don't find much use for su
in the traditional, super-user sense. sudo
handles that case much better. However, su
is great for becoming another user in one-off situations where configuring sudoers would be silly.
For example, if I'm repairing my system from a live CD/USB, I'll often mount my hard drive and other necessary stuff and chroot
into the system. In such a case, my first command is generally:
su - myuser # Note the '-'. It means to act as if that user had just logged in.
That way, I'm operating not as root, but as my normal user, and I then use sudo
as appropriate.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f70534%2fwhat-are-the-differences-between-su-sudo-s-sudo-i-sudo-su%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
The main difference between these commands is in the way they restrict access to their functions.
su
(which means "substitute user" or "switch user") - does exactly that, it starts another shell instance with privileges of the target user. To ensure you have the rights to do that, it asks you for the password of the target user. So, to become root, you need to know root password. If there are several users on your machine who need to run commands as root, they all need to know root password - note that it'll be the same password. If you need to revoke admin permissions from one of the users, you need to change root password and tell it only to those people who need to keep access - messy.
sudo
(hmm... what's the mnemonic? Super-User-DO?) is completely different. It uses a config file (/etc/sudoers) which lists which users have rights to specific actions (run commands as root, etc.) When invoked, it asks for the password of the user who started it - to ensure the person at the terminal is really the same "joe" who's listed in /etc/sudoers
. To revoke admin privileges from a person, you just need to edit the config file (or remove the user from a group which is listed in that config). This results in much cleaner management of privileges.
As a result of this, in many Debian-based systems root
user has no password set - i.e. it's not possible to login as root directly.
Also, /etc/sudoers
allows to specify some additional options - i.e. user X is only able to run program Y etc.
The often-used sudo su
combination works as follows: first sudo
asks you for your password, and, if you're allowed to do so, invokes the next command (su
) as a super-user. Because su
is invoked by root
, it does not require you to enter the target user's password. So, sudo su
allows you to open a shell as another user (including root), if you're allowed super-user access by the /etc/sudoers
file.
2
I've never seensu
as "switch user", but always as superuser; the default behavior without another's user name (though it makes sense). From wikipedia : "The su command, also referred to as super user[1] as early as 1974, has also been called "substitute user", "spoof user" or "set user" because it allows changing the account associated with the current terminal (window)."
– dr jimbob
Oct 22 '11 at 13:47
4
@dr jimbob: you're right, but I'm finding that "switch user" is kinda describes better what it does - though historically it stands for "super user". I'm also delighted to find that the wikipedia article is very similar to my answer - I never saw the article before :)
– Sergey
Oct 22 '11 at 20:33
11
The official meaning of "su" is "substitute user". See: "man su".
– Angel O'Sphere
Nov 26 '13 at 13:02
1
@AngelO'Sphere: Interestingly, Ubuntu's manpage does not mention "substitute" at all. The manpage at gnu.org (gnu.org/software/coreutils/manual/html_node/su-invocation.html) does indeed say "su: Run a command with substitute user and group ID". I think gnu.org is a canonical source :)
– Sergey
Nov 26 '13 at 20:25
1
What aboutsudo su
?
– Kaz Wolfe
Oct 15 '14 at 8:14
|
show 11 more comments
The main difference between these commands is in the way they restrict access to their functions.
su
(which means "substitute user" or "switch user") - does exactly that, it starts another shell instance with privileges of the target user. To ensure you have the rights to do that, it asks you for the password of the target user. So, to become root, you need to know root password. If there are several users on your machine who need to run commands as root, they all need to know root password - note that it'll be the same password. If you need to revoke admin permissions from one of the users, you need to change root password and tell it only to those people who need to keep access - messy.
sudo
(hmm... what's the mnemonic? Super-User-DO?) is completely different. It uses a config file (/etc/sudoers) which lists which users have rights to specific actions (run commands as root, etc.) When invoked, it asks for the password of the user who started it - to ensure the person at the terminal is really the same "joe" who's listed in /etc/sudoers
. To revoke admin privileges from a person, you just need to edit the config file (or remove the user from a group which is listed in that config). This results in much cleaner management of privileges.
As a result of this, in many Debian-based systems root
user has no password set - i.e. it's not possible to login as root directly.
Also, /etc/sudoers
allows to specify some additional options - i.e. user X is only able to run program Y etc.
The often-used sudo su
combination works as follows: first sudo
asks you for your password, and, if you're allowed to do so, invokes the next command (su
) as a super-user. Because su
is invoked by root
, it does not require you to enter the target user's password. So, sudo su
allows you to open a shell as another user (including root), if you're allowed super-user access by the /etc/sudoers
file.
2
I've never seensu
as "switch user", but always as superuser; the default behavior without another's user name (though it makes sense). From wikipedia : "The su command, also referred to as super user[1] as early as 1974, has also been called "substitute user", "spoof user" or "set user" because it allows changing the account associated with the current terminal (window)."
– dr jimbob
Oct 22 '11 at 13:47
4
@dr jimbob: you're right, but I'm finding that "switch user" is kinda describes better what it does - though historically it stands for "super user". I'm also delighted to find that the wikipedia article is very similar to my answer - I never saw the article before :)
– Sergey
Oct 22 '11 at 20:33
11
The official meaning of "su" is "substitute user". See: "man su".
– Angel O'Sphere
Nov 26 '13 at 13:02
1
@AngelO'Sphere: Interestingly, Ubuntu's manpage does not mention "substitute" at all. The manpage at gnu.org (gnu.org/software/coreutils/manual/html_node/su-invocation.html) does indeed say "su: Run a command with substitute user and group ID". I think gnu.org is a canonical source :)
– Sergey
Nov 26 '13 at 20:25
1
What aboutsudo su
?
– Kaz Wolfe
Oct 15 '14 at 8:14
|
show 11 more comments
The main difference between these commands is in the way they restrict access to their functions.
su
(which means "substitute user" or "switch user") - does exactly that, it starts another shell instance with privileges of the target user. To ensure you have the rights to do that, it asks you for the password of the target user. So, to become root, you need to know root password. If there are several users on your machine who need to run commands as root, they all need to know root password - note that it'll be the same password. If you need to revoke admin permissions from one of the users, you need to change root password and tell it only to those people who need to keep access - messy.
sudo
(hmm... what's the mnemonic? Super-User-DO?) is completely different. It uses a config file (/etc/sudoers) which lists which users have rights to specific actions (run commands as root, etc.) When invoked, it asks for the password of the user who started it - to ensure the person at the terminal is really the same "joe" who's listed in /etc/sudoers
. To revoke admin privileges from a person, you just need to edit the config file (or remove the user from a group which is listed in that config). This results in much cleaner management of privileges.
As a result of this, in many Debian-based systems root
user has no password set - i.e. it's not possible to login as root directly.
Also, /etc/sudoers
allows to specify some additional options - i.e. user X is only able to run program Y etc.
The often-used sudo su
combination works as follows: first sudo
asks you for your password, and, if you're allowed to do so, invokes the next command (su
) as a super-user. Because su
is invoked by root
, it does not require you to enter the target user's password. So, sudo su
allows you to open a shell as another user (including root), if you're allowed super-user access by the /etc/sudoers
file.
The main difference between these commands is in the way they restrict access to their functions.
su
(which means "substitute user" or "switch user") - does exactly that, it starts another shell instance with privileges of the target user. To ensure you have the rights to do that, it asks you for the password of the target user. So, to become root, you need to know root password. If there are several users on your machine who need to run commands as root, they all need to know root password - note that it'll be the same password. If you need to revoke admin permissions from one of the users, you need to change root password and tell it only to those people who need to keep access - messy.
sudo
(hmm... what's the mnemonic? Super-User-DO?) is completely different. It uses a config file (/etc/sudoers) which lists which users have rights to specific actions (run commands as root, etc.) When invoked, it asks for the password of the user who started it - to ensure the person at the terminal is really the same "joe" who's listed in /etc/sudoers
. To revoke admin privileges from a person, you just need to edit the config file (or remove the user from a group which is listed in that config). This results in much cleaner management of privileges.
As a result of this, in many Debian-based systems root
user has no password set - i.e. it's not possible to login as root directly.
Also, /etc/sudoers
allows to specify some additional options - i.e. user X is only able to run program Y etc.
The often-used sudo su
combination works as follows: first sudo
asks you for your password, and, if you're allowed to do so, invokes the next command (su
) as a super-user. Because su
is invoked by root
, it does not require you to enter the target user's password. So, sudo su
allows you to open a shell as another user (including root), if you're allowed super-user access by the /etc/sudoers
file.
edited Feb 6 '15 at 22:37
answered Oct 22 '11 at 7:21
SergeySergey
36.4k98799
36.4k98799
2
I've never seensu
as "switch user", but always as superuser; the default behavior without another's user name (though it makes sense). From wikipedia : "The su command, also referred to as super user[1] as early as 1974, has also been called "substitute user", "spoof user" or "set user" because it allows changing the account associated with the current terminal (window)."
– dr jimbob
Oct 22 '11 at 13:47
4
@dr jimbob: you're right, but I'm finding that "switch user" is kinda describes better what it does - though historically it stands for "super user". I'm also delighted to find that the wikipedia article is very similar to my answer - I never saw the article before :)
– Sergey
Oct 22 '11 at 20:33
11
The official meaning of "su" is "substitute user". See: "man su".
– Angel O'Sphere
Nov 26 '13 at 13:02
1
@AngelO'Sphere: Interestingly, Ubuntu's manpage does not mention "substitute" at all. The manpage at gnu.org (gnu.org/software/coreutils/manual/html_node/su-invocation.html) does indeed say "su: Run a command with substitute user and group ID". I think gnu.org is a canonical source :)
– Sergey
Nov 26 '13 at 20:25
1
What aboutsudo su
?
– Kaz Wolfe
Oct 15 '14 at 8:14
|
show 11 more comments
2
I've never seensu
as "switch user", but always as superuser; the default behavior without another's user name (though it makes sense). From wikipedia : "The su command, also referred to as super user[1] as early as 1974, has also been called "substitute user", "spoof user" or "set user" because it allows changing the account associated with the current terminal (window)."
– dr jimbob
Oct 22 '11 at 13:47
4
@dr jimbob: you're right, but I'm finding that "switch user" is kinda describes better what it does - though historically it stands for "super user". I'm also delighted to find that the wikipedia article is very similar to my answer - I never saw the article before :)
– Sergey
Oct 22 '11 at 20:33
11
The official meaning of "su" is "substitute user". See: "man su".
– Angel O'Sphere
Nov 26 '13 at 13:02
1
@AngelO'Sphere: Interestingly, Ubuntu's manpage does not mention "substitute" at all. The manpage at gnu.org (gnu.org/software/coreutils/manual/html_node/su-invocation.html) does indeed say "su: Run a command with substitute user and group ID". I think gnu.org is a canonical source :)
– Sergey
Nov 26 '13 at 20:25
1
What aboutsudo su
?
– Kaz Wolfe
Oct 15 '14 at 8:14
2
2
I've never seen
su
as "switch user", but always as superuser; the default behavior without another's user name (though it makes sense). From wikipedia : "The su command, also referred to as super user[1] as early as 1974, has also been called "substitute user", "spoof user" or "set user" because it allows changing the account associated with the current terminal (window)."– dr jimbob
Oct 22 '11 at 13:47
I've never seen
su
as "switch user", but always as superuser; the default behavior without another's user name (though it makes sense). From wikipedia : "The su command, also referred to as super user[1] as early as 1974, has also been called "substitute user", "spoof user" or "set user" because it allows changing the account associated with the current terminal (window)."– dr jimbob
Oct 22 '11 at 13:47
4
4
@dr jimbob: you're right, but I'm finding that "switch user" is kinda describes better what it does - though historically it stands for "super user". I'm also delighted to find that the wikipedia article is very similar to my answer - I never saw the article before :)
– Sergey
Oct 22 '11 at 20:33
@dr jimbob: you're right, but I'm finding that "switch user" is kinda describes better what it does - though historically it stands for "super user". I'm also delighted to find that the wikipedia article is very similar to my answer - I never saw the article before :)
– Sergey
Oct 22 '11 at 20:33
11
11
The official meaning of "su" is "substitute user". See: "man su".
– Angel O'Sphere
Nov 26 '13 at 13:02
The official meaning of "su" is "substitute user". See: "man su".
– Angel O'Sphere
Nov 26 '13 at 13:02
1
1
@AngelO'Sphere: Interestingly, Ubuntu's manpage does not mention "substitute" at all. The manpage at gnu.org (gnu.org/software/coreutils/manual/html_node/su-invocation.html) does indeed say "su: Run a command with substitute user and group ID". I think gnu.org is a canonical source :)
– Sergey
Nov 26 '13 at 20:25
@AngelO'Sphere: Interestingly, Ubuntu's manpage does not mention "substitute" at all. The manpage at gnu.org (gnu.org/software/coreutils/manual/html_node/su-invocation.html) does indeed say "su: Run a command with substitute user and group ID". I think gnu.org is a canonical source :)
– Sergey
Nov 26 '13 at 20:25
1
1
What about
sudo su
?– Kaz Wolfe
Oct 15 '14 at 8:14
What about
sudo su
?– Kaz Wolfe
Oct 15 '14 at 8:14
|
show 11 more comments
sudo
lets you run commands in your own user account with root privileges. su
lets you switch user so that you're actually logged in as root.
sudo -s
runs a shell with root privileges. sudo -i
also acquires the root user's environment.
To see the difference between su
and sudo -s
, do cd ~
and then pwd
after each of them. In the first case, you'll be in root's home directory, because you're root. In the second case, you'll be in your own home directory, because you're yourself with root privileges.
There's more discussion of this exact question here.
19
"you're yourself with root privileges" is not what's actually happening :) Actually, it's not possible to be "yourself with root privileges" - either you're root or you're yourself. Try typing whoami in both cases. The fact thatcd ~
results are different is a result of sudo -s not setting $HOME environment variable.
– Sergey
Oct 22 '11 at 7:28
1
@Sergey, whoami it says are 'root' because you are running the 'whoami' cmd as though you sudoed it, so temporarily (for the duration of that command) you appear to be the root user, but you might still not have full root access according to the sudoers file.
– Octopus
Feb 6 '15 at 22:15
1
@Octopus: what I was trying to say is that in Unix, a process can only have one UID, and that UID determines the permissions of the process. You can't be "yourself with root privileges", a program either runs with your UID or with root's UID (0).
– Sergey
Feb 6 '15 at 22:24
5
Regarding "you might still not have full root access according to the sudoers file": thesudoers
file controls who can run which command as another user, but that happens before the command is executed. However, once you were allowed to start a process as, say, root - the running process has root's UID and has a full access to the system, there's no way for sudo to restrict that. Again, you're always either yourself or root, there's no "half-n-half". So, ifsudoers
file allows you to run shell as root - permissions in that shell would be indistinguishable from a "normal" root shell.
– Sergey
Feb 6 '15 at 22:32
add a comment |
sudo
lets you run commands in your own user account with root privileges. su
lets you switch user so that you're actually logged in as root.
sudo -s
runs a shell with root privileges. sudo -i
also acquires the root user's environment.
To see the difference between su
and sudo -s
, do cd ~
and then pwd
after each of them. In the first case, you'll be in root's home directory, because you're root. In the second case, you'll be in your own home directory, because you're yourself with root privileges.
There's more discussion of this exact question here.
19
"you're yourself with root privileges" is not what's actually happening :) Actually, it's not possible to be "yourself with root privileges" - either you're root or you're yourself. Try typing whoami in both cases. The fact thatcd ~
results are different is a result of sudo -s not setting $HOME environment variable.
– Sergey
Oct 22 '11 at 7:28
1
@Sergey, whoami it says are 'root' because you are running the 'whoami' cmd as though you sudoed it, so temporarily (for the duration of that command) you appear to be the root user, but you might still not have full root access according to the sudoers file.
– Octopus
Feb 6 '15 at 22:15
1
@Octopus: what I was trying to say is that in Unix, a process can only have one UID, and that UID determines the permissions of the process. You can't be "yourself with root privileges", a program either runs with your UID or with root's UID (0).
– Sergey
Feb 6 '15 at 22:24
5
Regarding "you might still not have full root access according to the sudoers file": thesudoers
file controls who can run which command as another user, but that happens before the command is executed. However, once you were allowed to start a process as, say, root - the running process has root's UID and has a full access to the system, there's no way for sudo to restrict that. Again, you're always either yourself or root, there's no "half-n-half". So, ifsudoers
file allows you to run shell as root - permissions in that shell would be indistinguishable from a "normal" root shell.
– Sergey
Feb 6 '15 at 22:32
add a comment |
sudo
lets you run commands in your own user account with root privileges. su
lets you switch user so that you're actually logged in as root.
sudo -s
runs a shell with root privileges. sudo -i
also acquires the root user's environment.
To see the difference between su
and sudo -s
, do cd ~
and then pwd
after each of them. In the first case, you'll be in root's home directory, because you're root. In the second case, you'll be in your own home directory, because you're yourself with root privileges.
There's more discussion of this exact question here.
sudo
lets you run commands in your own user account with root privileges. su
lets you switch user so that you're actually logged in as root.
sudo -s
runs a shell with root privileges. sudo -i
also acquires the root user's environment.
To see the difference between su
and sudo -s
, do cd ~
and then pwd
after each of them. In the first case, you'll be in root's home directory, because you're root. In the second case, you'll be in your own home directory, because you're yourself with root privileges.
There's more discussion of this exact question here.
answered Oct 22 '11 at 6:28
Mike ScottMike Scott
1,64921214
1,64921214
19
"you're yourself with root privileges" is not what's actually happening :) Actually, it's not possible to be "yourself with root privileges" - either you're root or you're yourself. Try typing whoami in both cases. The fact thatcd ~
results are different is a result of sudo -s not setting $HOME environment variable.
– Sergey
Oct 22 '11 at 7:28
1
@Sergey, whoami it says are 'root' because you are running the 'whoami' cmd as though you sudoed it, so temporarily (for the duration of that command) you appear to be the root user, but you might still not have full root access according to the sudoers file.
– Octopus
Feb 6 '15 at 22:15
1
@Octopus: what I was trying to say is that in Unix, a process can only have one UID, and that UID determines the permissions of the process. You can't be "yourself with root privileges", a program either runs with your UID or with root's UID (0).
– Sergey
Feb 6 '15 at 22:24
5
Regarding "you might still not have full root access according to the sudoers file": thesudoers
file controls who can run which command as another user, but that happens before the command is executed. However, once you were allowed to start a process as, say, root - the running process has root's UID and has a full access to the system, there's no way for sudo to restrict that. Again, you're always either yourself or root, there's no "half-n-half". So, ifsudoers
file allows you to run shell as root - permissions in that shell would be indistinguishable from a "normal" root shell.
– Sergey
Feb 6 '15 at 22:32
add a comment |
19
"you're yourself with root privileges" is not what's actually happening :) Actually, it's not possible to be "yourself with root privileges" - either you're root or you're yourself. Try typing whoami in both cases. The fact thatcd ~
results are different is a result of sudo -s not setting $HOME environment variable.
– Sergey
Oct 22 '11 at 7:28
1
@Sergey, whoami it says are 'root' because you are running the 'whoami' cmd as though you sudoed it, so temporarily (for the duration of that command) you appear to be the root user, but you might still not have full root access according to the sudoers file.
– Octopus
Feb 6 '15 at 22:15
1
@Octopus: what I was trying to say is that in Unix, a process can only have one UID, and that UID determines the permissions of the process. You can't be "yourself with root privileges", a program either runs with your UID or with root's UID (0).
– Sergey
Feb 6 '15 at 22:24
5
Regarding "you might still not have full root access according to the sudoers file": thesudoers
file controls who can run which command as another user, but that happens before the command is executed. However, once you were allowed to start a process as, say, root - the running process has root's UID and has a full access to the system, there's no way for sudo to restrict that. Again, you're always either yourself or root, there's no "half-n-half". So, ifsudoers
file allows you to run shell as root - permissions in that shell would be indistinguishable from a "normal" root shell.
– Sergey
Feb 6 '15 at 22:32
19
19
"you're yourself with root privileges" is not what's actually happening :) Actually, it's not possible to be "yourself with root privileges" - either you're root or you're yourself. Try typing whoami in both cases. The fact that
cd ~
results are different is a result of sudo -s not setting $HOME environment variable.– Sergey
Oct 22 '11 at 7:28
"you're yourself with root privileges" is not what's actually happening :) Actually, it's not possible to be "yourself with root privileges" - either you're root or you're yourself. Try typing whoami in both cases. The fact that
cd ~
results are different is a result of sudo -s not setting $HOME environment variable.– Sergey
Oct 22 '11 at 7:28
1
1
@Sergey, whoami it says are 'root' because you are running the 'whoami' cmd as though you sudoed it, so temporarily (for the duration of that command) you appear to be the root user, but you might still not have full root access according to the sudoers file.
– Octopus
Feb 6 '15 at 22:15
@Sergey, whoami it says are 'root' because you are running the 'whoami' cmd as though you sudoed it, so temporarily (for the duration of that command) you appear to be the root user, but you might still not have full root access according to the sudoers file.
– Octopus
Feb 6 '15 at 22:15
1
1
@Octopus: what I was trying to say is that in Unix, a process can only have one UID, and that UID determines the permissions of the process. You can't be "yourself with root privileges", a program either runs with your UID or with root's UID (0).
– Sergey
Feb 6 '15 at 22:24
@Octopus: what I was trying to say is that in Unix, a process can only have one UID, and that UID determines the permissions of the process. You can't be "yourself with root privileges", a program either runs with your UID or with root's UID (0).
– Sergey
Feb 6 '15 at 22:24
5
5
Regarding "you might still not have full root access according to the sudoers file": the
sudoers
file controls who can run which command as another user, but that happens before the command is executed. However, once you were allowed to start a process as, say, root - the running process has root's UID and has a full access to the system, there's no way for sudo to restrict that. Again, you're always either yourself or root, there's no "half-n-half". So, if sudoers
file allows you to run shell as root - permissions in that shell would be indistinguishable from a "normal" root shell.– Sergey
Feb 6 '15 at 22:32
Regarding "you might still not have full root access according to the sudoers file": the
sudoers
file controls who can run which command as another user, but that happens before the command is executed. However, once you were allowed to start a process as, say, root - the running process has root's UID and has a full access to the system, there's no way for sudo to restrict that. Again, you're always either yourself or root, there's no "half-n-half". So, if sudoers
file allows you to run shell as root - permissions in that shell would be indistinguishable from a "normal" root shell.– Sergey
Feb 6 '15 at 22:32
add a comment |
This answer is a dupe of my answer on a dupe of this question, put here on the canonical answer so that people can find it!
The major difference between sudo -i
and sudo -s
is:
sudo -i
gives you the root environment, i.e. your~/.bashrc
is ignored.
sudo -s
gives you the user's environment, so your~/.bashrc
is respected.
Here is an example, you can see that I have an application lsl
in my ~/.bin/
directory which is accessible via sudo -s
but not accessible with sudo -i
. Note also that the Bash prompt changes as will with sudo -i
but not with sudo -s
:
dotancohen@melancholy:~$ ls .bin
lsl
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ sudo -i
root@melancholy:~# which lsl
root@melancholy:~# exit
logout
dotancohen@melancholy:~$ sudo -s
Sourced .bashrc
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ exit
exit
Though sudo -s
is convenient for giving you the environment that you are familiar with, I recommend the use of sudo -i
for two reasons:
- The visual reminder that you are in a 'root' session.
- The root environment is far less likely to be poisoned with malware, such as a rogue line in
.bashrc
.
I noticed sudo -s doesnt seem to process /etc/profile , or anything I have in /etc/profile.d/ .. any idea why?
– meffect
Feb 23 '17 at 5:21
@dotancohen - What do you mean bysudo -s
provides an environment that a user is familiar with?
– Motivated
Jan 16 at 19:18
@dotancohen - The command sudo -s already provides visual cues so i'm curios as to why sudo -i is a better option.
– Motivated
Jan 16 at 19:28
add a comment |
This answer is a dupe of my answer on a dupe of this question, put here on the canonical answer so that people can find it!
The major difference between sudo -i
and sudo -s
is:
sudo -i
gives you the root environment, i.e. your~/.bashrc
is ignored.
sudo -s
gives you the user's environment, so your~/.bashrc
is respected.
Here is an example, you can see that I have an application lsl
in my ~/.bin/
directory which is accessible via sudo -s
but not accessible with sudo -i
. Note also that the Bash prompt changes as will with sudo -i
but not with sudo -s
:
dotancohen@melancholy:~$ ls .bin
lsl
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ sudo -i
root@melancholy:~# which lsl
root@melancholy:~# exit
logout
dotancohen@melancholy:~$ sudo -s
Sourced .bashrc
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ exit
exit
Though sudo -s
is convenient for giving you the environment that you are familiar with, I recommend the use of sudo -i
for two reasons:
- The visual reminder that you are in a 'root' session.
- The root environment is far less likely to be poisoned with malware, such as a rogue line in
.bashrc
.
I noticed sudo -s doesnt seem to process /etc/profile , or anything I have in /etc/profile.d/ .. any idea why?
– meffect
Feb 23 '17 at 5:21
@dotancohen - What do you mean bysudo -s
provides an environment that a user is familiar with?
– Motivated
Jan 16 at 19:18
@dotancohen - The command sudo -s already provides visual cues so i'm curios as to why sudo -i is a better option.
– Motivated
Jan 16 at 19:28
add a comment |
This answer is a dupe of my answer on a dupe of this question, put here on the canonical answer so that people can find it!
The major difference between sudo -i
and sudo -s
is:
sudo -i
gives you the root environment, i.e. your~/.bashrc
is ignored.
sudo -s
gives you the user's environment, so your~/.bashrc
is respected.
Here is an example, you can see that I have an application lsl
in my ~/.bin/
directory which is accessible via sudo -s
but not accessible with sudo -i
. Note also that the Bash prompt changes as will with sudo -i
but not with sudo -s
:
dotancohen@melancholy:~$ ls .bin
lsl
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ sudo -i
root@melancholy:~# which lsl
root@melancholy:~# exit
logout
dotancohen@melancholy:~$ sudo -s
Sourced .bashrc
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ exit
exit
Though sudo -s
is convenient for giving you the environment that you are familiar with, I recommend the use of sudo -i
for two reasons:
- The visual reminder that you are in a 'root' session.
- The root environment is far less likely to be poisoned with malware, such as a rogue line in
.bashrc
.
This answer is a dupe of my answer on a dupe of this question, put here on the canonical answer so that people can find it!
The major difference between sudo -i
and sudo -s
is:
sudo -i
gives you the root environment, i.e. your~/.bashrc
is ignored.
sudo -s
gives you the user's environment, so your~/.bashrc
is respected.
Here is an example, you can see that I have an application lsl
in my ~/.bin/
directory which is accessible via sudo -s
but not accessible with sudo -i
. Note also that the Bash prompt changes as will with sudo -i
but not with sudo -s
:
dotancohen@melancholy:~$ ls .bin
lsl
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ sudo -i
root@melancholy:~# which lsl
root@melancholy:~# exit
logout
dotancohen@melancholy:~$ sudo -s
Sourced .bashrc
dotancohen@melancholy:~$ which lsl
/home/dotancohen/.bin/lsl
dotancohen@melancholy:~$ exit
exit
Though sudo -s
is convenient for giving you the environment that you are familiar with, I recommend the use of sudo -i
for two reasons:
- The visual reminder that you are in a 'root' session.
- The root environment is far less likely to be poisoned with malware, such as a rogue line in
.bashrc
.
edited Apr 13 '17 at 12:23
Community♦
1
1
answered Nov 8 '14 at 14:07
dotancohendotancohen
1,68242335
1,68242335
I noticed sudo -s doesnt seem to process /etc/profile , or anything I have in /etc/profile.d/ .. any idea why?
– meffect
Feb 23 '17 at 5:21
@dotancohen - What do you mean bysudo -s
provides an environment that a user is familiar with?
– Motivated
Jan 16 at 19:18
@dotancohen - The command sudo -s already provides visual cues so i'm curios as to why sudo -i is a better option.
– Motivated
Jan 16 at 19:28
add a comment |
I noticed sudo -s doesnt seem to process /etc/profile , or anything I have in /etc/profile.d/ .. any idea why?
– meffect
Feb 23 '17 at 5:21
@dotancohen - What do you mean bysudo -s
provides an environment that a user is familiar with?
– Motivated
Jan 16 at 19:18
@dotancohen - The command sudo -s already provides visual cues so i'm curios as to why sudo -i is a better option.
– Motivated
Jan 16 at 19:28
I noticed sudo -s doesnt seem to process /etc/profile , or anything I have in /etc/profile.d/ .. any idea why?
– meffect
Feb 23 '17 at 5:21
I noticed sudo -s doesnt seem to process /etc/profile , or anything I have in /etc/profile.d/ .. any idea why?
– meffect
Feb 23 '17 at 5:21
@dotancohen - What do you mean by
sudo -s
provides an environment that a user is familiar with?– Motivated
Jan 16 at 19:18
@dotancohen - What do you mean by
sudo -s
provides an environment that a user is familiar with?– Motivated
Jan 16 at 19:18
@dotancohen - The command sudo -s already provides visual cues so i'm curios as to why sudo -i is a better option.
– Motivated
Jan 16 at 19:28
@dotancohen - The command sudo -s already provides visual cues so i'm curios as to why sudo -i is a better option.
– Motivated
Jan 16 at 19:28
add a comment |
su
asks for the password of the user "root".
sudo
asks for your own password (and also checks if you're allowed to run commands as root, which is configured through /etc/sudoers
-- by default all user accounts that belong to the "admin" or "sudo" groups are allowed to use sudo).
sudo -s
launches a shell as root, but doesn't change your working directory. sudo -i
simulates a login into the root account: your working directory will be /root
, and root's .profile
etc. will be sourced as if on login.
1
to make the answer more complete:sudo -s
is almost equal tosu
($HOME is different) andsudo -i
is equal tosu -
– DJCrashdummy
Jul 29 '17 at 0:58
@DJCrashdummy - Why do you say almost equal to? What is different?
– Motivated
Jan 17 at 4:38
add a comment |
su
asks for the password of the user "root".
sudo
asks for your own password (and also checks if you're allowed to run commands as root, which is configured through /etc/sudoers
-- by default all user accounts that belong to the "admin" or "sudo" groups are allowed to use sudo).
sudo -s
launches a shell as root, but doesn't change your working directory. sudo -i
simulates a login into the root account: your working directory will be /root
, and root's .profile
etc. will be sourced as if on login.
1
to make the answer more complete:sudo -s
is almost equal tosu
($HOME is different) andsudo -i
is equal tosu -
– DJCrashdummy
Jul 29 '17 at 0:58
@DJCrashdummy - Why do you say almost equal to? What is different?
– Motivated
Jan 17 at 4:38
add a comment |
su
asks for the password of the user "root".
sudo
asks for your own password (and also checks if you're allowed to run commands as root, which is configured through /etc/sudoers
-- by default all user accounts that belong to the "admin" or "sudo" groups are allowed to use sudo).
sudo -s
launches a shell as root, but doesn't change your working directory. sudo -i
simulates a login into the root account: your working directory will be /root
, and root's .profile
etc. will be sourced as if on login.
su
asks for the password of the user "root".
sudo
asks for your own password (and also checks if you're allowed to run commands as root, which is configured through /etc/sudoers
-- by default all user accounts that belong to the "admin" or "sudo" groups are allowed to use sudo).
sudo -s
launches a shell as root, but doesn't change your working directory. sudo -i
simulates a login into the root account: your working directory will be /root
, and root's .profile
etc. will be sourced as if on login.
edited Jan 17 at 11:33
answered Oct 22 '11 at 19:38
Marius GedminasMarius Gedminas
7,39573647
7,39573647
1
to make the answer more complete:sudo -s
is almost equal tosu
($HOME is different) andsudo -i
is equal tosu -
– DJCrashdummy
Jul 29 '17 at 0:58
@DJCrashdummy - Why do you say almost equal to? What is different?
– Motivated
Jan 17 at 4:38
add a comment |
1
to make the answer more complete:sudo -s
is almost equal tosu
($HOME is different) andsudo -i
is equal tosu -
– DJCrashdummy
Jul 29 '17 at 0:58
@DJCrashdummy - Why do you say almost equal to? What is different?
– Motivated
Jan 17 at 4:38
1
1
to make the answer more complete:
sudo -s
is almost equal to su
($HOME is different) and sudo -i
is equal to su -
– DJCrashdummy
Jul 29 '17 at 0:58
to make the answer more complete:
sudo -s
is almost equal to su
($HOME is different) and sudo -i
is equal to su -
– DJCrashdummy
Jul 29 '17 at 0:58
@DJCrashdummy - Why do you say almost equal to? What is different?
– Motivated
Jan 17 at 4:38
@DJCrashdummy - Why do you say almost equal to? What is different?
– Motivated
Jan 17 at 4:38
add a comment |
In Ubuntu or a related system, I don't find much use for su
in the traditional, super-user sense. sudo
handles that case much better. However, su
is great for becoming another user in one-off situations where configuring sudoers would be silly.
For example, if I'm repairing my system from a live CD/USB, I'll often mount my hard drive and other necessary stuff and chroot
into the system. In such a case, my first command is generally:
su - myuser # Note the '-'. It means to act as if that user had just logged in.
That way, I'm operating not as root, but as my normal user, and I then use sudo
as appropriate.
add a comment |
In Ubuntu or a related system, I don't find much use for su
in the traditional, super-user sense. sudo
handles that case much better. However, su
is great for becoming another user in one-off situations where configuring sudoers would be silly.
For example, if I'm repairing my system from a live CD/USB, I'll often mount my hard drive and other necessary stuff and chroot
into the system. In such a case, my first command is generally:
su - myuser # Note the '-'. It means to act as if that user had just logged in.
That way, I'm operating not as root, but as my normal user, and I then use sudo
as appropriate.
add a comment |
In Ubuntu or a related system, I don't find much use for su
in the traditional, super-user sense. sudo
handles that case much better. However, su
is great for becoming another user in one-off situations where configuring sudoers would be silly.
For example, if I'm repairing my system from a live CD/USB, I'll often mount my hard drive and other necessary stuff and chroot
into the system. In such a case, my first command is generally:
su - myuser # Note the '-'. It means to act as if that user had just logged in.
That way, I'm operating not as root, but as my normal user, and I then use sudo
as appropriate.
In Ubuntu or a related system, I don't find much use for su
in the traditional, super-user sense. sudo
handles that case much better. However, su
is great for becoming another user in one-off situations where configuring sudoers would be silly.
For example, if I'm repairing my system from a live CD/USB, I'll often mount my hard drive and other necessary stuff and chroot
into the system. In such a case, my first command is generally:
su - myuser # Note the '-'. It means to act as if that user had just logged in.
That way, I'm operating not as root, but as my normal user, and I then use sudo
as appropriate.
answered Oct 26 '11 at 7:23
Scott SeveranceScott Severance
10.4k73568
10.4k73568
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f70534%2fwhat-are-the-differences-between-su-sudo-s-sudo-i-sudo-su%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
6
Also, do not use
su user
to login from untrusted shells, butsu - user
. See unix.stackexchange.com/q/7013/8250– Lekensteyn
Oct 22 '11 at 8:45
@Lekensteyn wow, great example. thx for the LOL :)
– törzsmókus
Jan 30 '15 at 15:11
1
always remember the old commandment: thou shalt not claim root's name in vain!
– törzsmókus
Jan 30 '15 at 15:11
Not saying
sudo -i
is bad, but you can certainly f*** things up using it– Kolob Canyon
Nov 15 '16 at 22:06
Near-duplicate: askubuntu.com/questions/376199/…
– Reinier Post
Jun 6 '17 at 9:59