Questions tagged [su]

command for substituting user i.e. logging to a session as a different user.

su which is short of "substitute user" or "super user", allows to become another user after entering their password. In Ubuntu, since the root account is disabled by default and instead is replaced by sudo.

There are ways to enable the root account for its more common usage, through is not recommended. You can have the same functionality as su using the sudo -i command or sudo -u user -i.

197 questions
321
votes
2 answers

'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?

When I'm doing something that requires root be typed in dozens of times in a row, I prefer to switch my session to a root session. In the various tutorials and instructions I have used on the Internet, I see sudo su, sudo su -, sudo -i and sudo…
Paul
  • 4,606
195
votes
6 answers

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…
Smile.Hunter
  • 8,705
168
votes
5 answers

Why does su fail with "authentication error"?

I tried to su to root so I could install lights, but I get an authentication error when I try: user@host:~$ su Password: su: Authentication failure
Michael
  • 2,597
104
votes
6 answers

How to avoid being prompted for a password by sudo?

I know I can become root (super user) via the su command but I have to authorize it after entering the commands. Is there a way I can become root and authorize (with password) in one line
Vader
  • 1,462
66
votes
7 answers

Why am I getting "Authentication failure" when running the "su" command?

I am having problems with the su command. I know my password and I am typing it correctly, but su indicates Authentication failure. So I checked on the internet and then went into recovery mode and changed my user's password to what I was entering…
user12895
  • 815
48
votes
3 answers

What are the differences between sudo, su, visudo, chroot, and gksu?

What are the differences between sudo, su, visudo, chroot, and gksu ?
lambda23
  • 3,362
46
votes
12 answers

How can I run an application with a GUI as admin from a non-admin user session?

I defined 2 user accounts: one with admin privilege (with sudo right) => lets call it adminuser. a 2nd one without any privilege => lets call it normaluser and I configure the autologin on this 2nd user normaluser. So when I open a normaluser…
Boris
  • 5,012
28
votes
4 answers

Why is sudo -s better than sudo su?

I’ve seen many comments here in Ask Ubuntu regarding preference in using sudo -s rather than sudo su. For me, that two commands do exactly the same. But why is sudo -s supposed to be better?
fitojb
  • 2,233
26
votes
2 answers

How to run a command as a user whose login is disabled?

I am trying to use the su command to run an application as another user In this case I am trying to run irssi blah@ubuntu: su - [username] irssi (enter password) blah@ubuntu: (nothing happens) blah@ubuntu: su - [username] -c irssi (nothing) I run…
24
votes
4 answers

Is there a single line command to do `su`?

I can do an su with su and it asks for my password. Is there a password parameter for su such that i wont be prompted for a password? e.g. su -p
alvas
  • 3,027
24
votes
7 answers

What are the benefits of sudo over su?

What is the actual benefit that Ubuntu (or Debian derivatives) achieve by disabling root user? Everywhere I read, it says to prevent unintentional damages for inexperienced users. I want to know what exactly, since sudo can execute all commands…
Web-E
  • 21,716
19
votes
3 answers

Best practices on using sudo in a bash script

I have a long and long-running bash script where a handful of commands need to be run as root while the majority of commands need to be run as the regular user before sudo, because it would mess up file ownership and such. I came up with some…
Dakkaron
  • 304
19
votes
2 answers

What's the difference between login as user and changing users using su through root?

When you have a server of some sort you can access it through, e.g., ssh user1@ip and you can also do ssh root@ip to go to your root user with su priveleges and then go to su user1. In my thinking both those ways should lead me to the same user…
15
votes
5 answers

Why doesn't the 'su' command work in Ubuntu but does in other Linux distros?

When I type the su command in a terminal I get su: Authentication failure Why doesn't this work in Ubuntu? I have tried this command in another Linux distro (Parrot OS) and it does work.
giga
  • 193
15
votes
1 answer

How to switch user in terminal

I am currently: root@sensu-server-client:/# I wish to change to: sensu@sensu-server-client:/# How does one do this. I tried: su sensu but nothing happens.
1
2 3
13 14