1 00:00:06,540 --> 00:00:07,469 So let's talk about su. 2 00:00:09,410 --> 00:00:15,890 Why would you use su? Well, SU is a switch user and it allows you to open a shell as a specific user. 3 00:00:16,850 --> 00:00:21,295 For instance, if you use SU lisa, then you will be prompted for a password, 4 00:00:21,295 --> 00:00:25,740 which is a password of user lisa and open a shell as usual lisa. 5 00:00:26,480 --> 00:00:30,120 If you do this with super user privileges, you won't be prompted for a password. 6 00:00:31,399 --> 00:00:36,120 If you use SU without any further arguments, it will prompt for the root password 7 00:00:36,120 --> 00:00:40,840 and open a root shell. Now, when you use su, you open a subshell. 8 00:00:42,020 --> 00:00:47,850 That means that not all the environment variables are set as a target user. That might not be what you want. 9 00:00:48,350 --> 00:00:50,500 For that reason, it might be better to use su. 10 00:00:51,939 --> 00:00:56,034 SU opens a login shell, which means that environment variables are set as 11 00:00:56,034 --> 00:01:00,129 a target user and you really appear to be the target user. 12 00:01:00,869 --> 00:01:05,670 User root can use SU to become any user without entering a password. 13 00:01:06,310 --> 00:01:11,140 Regular users can use SU also, but they need the target user password. 14 00:01:11,799 --> 00:01:12,980 Let me show you how it works. 15 00:01:14,799 --> 00:01:19,420 Here I am in a root shell and in this machine I do have a couple of users. 16 00:01:20,019 --> 00:01:25,676 The use case for user su is if you have administrative access, you use SU lynda, for instance, 17 00:01:25,676 --> 00:01:31,333 which allows you to become user lynda without entering a password or whatsoever. Now why would you want 18 00:01:31,333 --> 00:01:36,989 to become user Lynda? Let me type who am I to verify that I really am? 19 00:01:37,489 --> 00:01:41,319 Well, for instance, to verify that you have set up permissions the right 20 00:01:41,319 --> 00:01:45,150 way and user lynda can do whatever that user wants to do. 21 00:01:46,170 --> 00:01:50,230 It's also possible to do this from a shell that is not a root shell. 22 00:01:51,390 --> 00:01:58,284 Then either you use sulinda and enter the password for user, which is getting 23 00:01:58,284 --> 00:02:05,180 you in, or you use your sudo superpowers using sudo su minus linda. 24 00:02:05,980 --> 00:02:10,460 And then you're not prompted for the password of the target user, but for your 25 00:02:10,460 --> 00:02:14,939 own user password, because that is what you need to invoke your sudo superpowers.