1 00:00:00,000 --> 00:00:01,835 [No audio] 2 00:00:01,835 --> 00:00:04,210 Talking to users. 3 00:00:04,210 --> 00:00:06,702 The users are the ones that are logged into 4 00:00:06,776 --> 00:00:12,934 your system and some of them have their applications 5 00:00:12,982 --> 00:00:15,630 running, some of them have databases running. 6 00:00:15,680 --> 00:00:19,062 Those are the users that log into the Linux system and there 7 00:00:19,076 --> 00:00:22,050 are often times you do need to talk to them. 8 00:00:22,100 --> 00:00:24,954 When I say talk to them, not like face to 9 00:00:24,992 --> 00:00:28,926 face but you do need to communicate to them that 10 00:00:28,988 --> 00:00:31,362 if you need to bring down your Linux system or 11 00:00:31,376 --> 00:00:34,378 if there's a maintenance or if there are any commands 12 00:00:34,414 --> 00:00:38,626 or any application that they are running, that are causing stress 13 00:00:38,698 --> 00:00:42,070 on the system, you do need to identify them. Command 14 00:00:42,130 --> 00:00:45,030 to find out is just typing users. 15 00:00:46,070 --> 00:00:48,342 Then there is a command called wall. 16 00:00:48,536 --> 00:00:52,830 wall is the command that is broadcast your message 17 00:00:53,000 --> 00:00:57,140 to everyone who is logged into the Linux system. 18 00:00:57,950 --> 00:01:01,460 And then there is last command which is write 19 00:01:01,910 --> 00:01:06,813 command is dedicated to a user, one specific user. 20 00:01:06,861 --> 00:01:08,670 It does not go out or your 21 00:01:08,720 --> 00:01:11,898 message does not broadcast it to everyone. 22 00:01:11,984 --> 00:01:14,118 It's just one user to another. 23 00:01:14,264 --> 00:01:17,418 So we'll log into our Linux system and we will 24 00:01:17,444 --> 00:01:20,574 try all these commands one by one and we will 25 00:01:20,612 --> 00:01:23,434 see how we could talk to other users. 26 00:01:23,602 --> 00:01:26,406 I have my Linux machine up and running 27 00:01:26,468 --> 00:01:29,840 and I am logged in as myself. 28 00:01:30,410 --> 00:01:35,060 And I could also see here I'm logged in as myself. 29 00:01:36,050 --> 00:01:38,886 The first command that I have is wall. 30 00:01:38,948 --> 00:01:45,106 So before I go into this first command, sorry first command is user, 31 00:01:45,298 --> 00:01:50,010 let's find out who is logged into the system. 32 00:01:50,180 --> 00:01:51,954 But what I was going to say is 33 00:01:51,992 --> 00:01:54,282 before we run this command I will log 34 00:01:54,356 --> 00:01:59,074 into another terminal as a different user. 35 00:01:59,182 --> 00:02:02,214 So to log into through another terminal, which 36 00:02:02,252 --> 00:02:04,638 would be the PuTTY terminal, I would need 37 00:02:04,664 --> 00:02:07,170 the IP address of this Linux machine. 38 00:02:07,850 --> 00:02:09,500 Let's check the IP address. 39 00:02:09,949 --> 00:02:12,497 You guys know that, right? Yes. 40 00:02:12,584 --> 00:02:14,982 We could run ifconfig, and the reason I 41 00:02:14,996 --> 00:02:17,502 put it more, I'm sure you know that 42 00:02:17,576 --> 00:02:19,962 so I could see the output one page at a time. 43 00:02:20,096 --> 00:02:22,014 I see my IP right here is 44 00:02:22,014 --> 00:02:25,160 192.168.1.12. 45 00:02:25,610 --> 00:02:28,674 I will take that IP and I 46 00:02:28,712 --> 00:02:30,958 will put it into my PuTTY session. 47 00:02:31,114 --> 00:02:35,802 192.168.1.12. 48 00:02:35,802 --> 00:02:43,210 [No audio] 49 00:02:43,210 --> 00:02:44,676 You hit enter. 50 00:02:44,676 --> 00:02:47,654 It will prompt you for the server SSH 51 00:02:47,762 --> 00:02:49,402 key that you wanted to save it. 52 00:02:49,416 --> 00:02:51,060 You could just say click Yes. 53 00:02:52,230 --> 00:02:54,082 And now this time I want you 54 00:02:54,096 --> 00:02:56,470 to log in as a different user. 55 00:02:56,790 --> 00:03:00,070 The user that I created earlier, I called the 56 00:03:00,120 --> 00:03:05,230 spider and put in the password for the spider. 57 00:03:06,270 --> 00:03:08,114 Now I'm logged in as a spider. 58 00:03:08,222 --> 00:03:10,814 If you logged in as yourself on your terminal, 59 00:03:10,862 --> 00:03:14,098 you can log out, or you open up another 60 00:03:14,184 --> 00:03:16,994 PuTTY terminal and log into a different user. 61 00:03:17,102 --> 00:03:19,718 And those users are the ones that we created earlier. 62 00:03:19,754 --> 00:03:21,742 You could pick any user, it doesn't really matter. 63 00:03:21,876 --> 00:03:23,494 Now we will see how many 64 00:03:23,532 --> 00:03:26,650 users are logged into our system. 65 00:03:26,820 --> 00:03:31,270 The command to see is just type, sorry, users. 66 00:03:31,710 --> 00:03:34,702 And you'll see there are three users logged in. 67 00:03:34,836 --> 00:03:36,802 Two of them are the ones 68 00:03:36,936 --> 00:03:39,010 sessions that are used by myself. 69 00:03:39,180 --> 00:03:41,810 And the third one is the spider. 70 00:03:41,990 --> 00:03:45,840 spider is the one is this one that I just logged into. 71 00:03:46,890 --> 00:03:49,654 Now I'm here, right now, in this 72 00:03:49,692 --> 00:03:52,980 session, I am logged in as myself. 73 00:03:53,310 --> 00:03:55,862 In this session, I'm logged in as spider. 74 00:03:56,006 --> 00:04:00,778 So if I want to reboot this machine or I 75 00:04:00,804 --> 00:04:04,750 want to shut it down for some kind of maintenance, 76 00:04:05,130 --> 00:04:08,894 then I have to let everyone know who is logged 77 00:04:08,942 --> 00:04:13,610 into my machine, that I am shutting down this machine. 78 00:04:13,670 --> 00:04:15,742 So please save your work 79 00:04:15,816 --> 00:04:19,094 if you are editing a file or whatever that you're 80 00:04:19,142 --> 00:04:22,440 doing, log off the system so I could reboot it. 81 00:04:22,890 --> 00:04:24,766 And how do I broadcast that? 82 00:04:24,827 --> 00:04:27,120 I will just type the command wall. 83 00:04:27,630 --> 00:04:28,860 I'll hit Enter. 84 00:04:30,150 --> 00:04:32,602 Enter one more time if you want to put a space, 85 00:04:32,736 --> 00:04:34,774 and then you could type whatever the 86 00:04:34,812 --> 00:04:36,647 message that you want to type here. 87 00:04:36,647 --> 00:04:41,285 I'll type, Please logoff, 88 00:04:42,330 --> 00:04:50,762 This system is coming down for maintenance. 89 00:04:50,762 --> 00:04:54,430 [No audio] 90 00:04:54,430 --> 00:04:56,282 Imran. That's my message. 91 00:04:56,356 --> 00:04:59,570 And once you have that, then you type Control d. 92 00:05:00,190 --> 00:05:02,714 As soon as you type Control d, you see on the 93 00:05:02,752 --> 00:05:06,206 left hand side, the message came up right away. 94 00:05:06,328 --> 00:05:07,358 Please log off, 95 00:05:07,444 --> 00:05:09,666 The system is coming down for maintenance. 96 00:05:09,798 --> 00:05:12,122 So this message is not only 97 00:05:12,196 --> 00:05:15,150 directed towards spider, the user spider. 98 00:05:15,210 --> 00:05:17,498 It is directed to anyone who is logged in. 99 00:05:17,524 --> 00:05:19,610 It will go to everyone's terminal 100 00:05:20,110 --> 00:05:22,022 and you see that message. 101 00:05:22,156 --> 00:05:24,770 And now you notice you don't have a prompt. 102 00:05:25,330 --> 00:05:27,146 You're just inside of your message, 103 00:05:27,208 --> 00:05:28,130 you simply hit Enter, 104 00:05:28,180 --> 00:05:29,474 you'll get your prompt back. 105 00:05:29,632 --> 00:05:33,914 Now what if I want to write 106 00:05:33,952 --> 00:05:36,354 a message to a specific user? 107 00:05:36,522 --> 00:05:38,814 So in this case, who are the users? 108 00:05:38,922 --> 00:05:41,810 Right now I see that two sessions being used by 109 00:05:41,860 --> 00:05:45,042 iafzal, and one session is used by spider. 110 00:05:45,186 --> 00:05:48,326 I want to send a message to spider saying, 111 00:05:48,388 --> 00:05:52,310 hey spider, you are using some of the resources 112 00:05:52,930 --> 00:05:55,970 through this script or through your application. 113 00:05:56,140 --> 00:05:58,094 Can you please stop the application because 114 00:05:58,132 --> 00:06:00,014 it's causing stress on the system. 115 00:06:00,172 --> 00:06:02,942 These are the type of messages you have to 116 00:06:03,076 --> 00:06:04,982 send it to the user when you become a 117 00:06:04,996 --> 00:06:08,330 system administrator or you have a root privileges. 118 00:06:08,830 --> 00:06:11,054 So to write to user, you just 119 00:06:11,092 --> 00:06:15,350 simply type write and the username spider. 120 00:06:16,270 --> 00:06:17,750 Then you hit Enter. 121 00:06:17,920 --> 00:06:19,718 As soon as you hit Enter, you will 122 00:06:19,744 --> 00:06:22,350 see on the left hand side, the spider 123 00:06:22,470 --> 00:06:25,180 is getting the message right away from you. 124 00:06:25,180 --> 00:06:27,599 I'll put, Hi Spider, 125 00:06:27,599 --> 00:06:29,350 [No audio] 126 00:06:29,350 --> 00:06:34,730 your web is getting bigger. 127 00:06:36,310 --> 00:06:42,602 Please stop spreading your web. 128 00:06:42,796 --> 00:06:45,186 It's just an example of funny sentence. 129 00:06:45,318 --> 00:06:47,294 So I have written this. 130 00:06:47,332 --> 00:06:48,290 I'll hit Enter. 131 00:06:48,400 --> 00:06:50,918 As soon as I hit Enter, you'll see on the 132 00:06:50,944 --> 00:06:53,874 left hand side Hi Spider,, your web is getting bigger. 133 00:06:53,922 --> 00:06:55,838 Please stop spreading your web. 134 00:06:55,984 --> 00:06:59,958 This message is not directed toward 135 00:07:00,054 --> 00:07:01,394 everyone who is logged in. 136 00:07:01,432 --> 00:07:04,470 It's only going to the user spider. 137 00:07:04,650 --> 00:07:06,158 And if you see right here, 138 00:07:06,244 --> 00:07:09,450 it's saying Message from iafzal. 139 00:07:09,510 --> 00:07:14,500 It means it's coming from this user, from this machine. Perfect. 140 00:07:14,500 --> 00:07:21,470 [No audio] 141 00:07:21,470 --> 00:07:24,498 Type write iafzal, and right here I 142 00:07:24,524 --> 00:07:29,060 say, ok Imran I will try my best. 143 00:07:30,770 --> 00:07:33,050 Thanks Spider. 144 00:07:33,050 --> 00:07:35,430 [No audio] 145 00:07:35,430 --> 00:07:37,066 And then control G. 146 00:07:37,188 --> 00:07:41,114 That's it, that's how you communicate with each users. 147 00:07:41,162 --> 00:07:45,660 And I have communicated through iafzal, of course. 148 00:07:45,990 --> 00:07:48,998 And most of the time that communication 149 00:07:49,094 --> 00:07:51,794 takes place through the user se mes 150 00:07:51,902 --> 00:07:54,590 Root is the one who sends those messages 151 00:07:54,650 --> 00:07:59,050 because root has the highest level of permissions, 152 00:07:59,670 --> 00:08:03,214 higher level to reboot the system, to bring 153 00:08:03,252 --> 00:08:06,074 it down, to perform the maintenance. 154 00:08:06,182 --> 00:08:08,510 That's why we run these commands. 155 00:08:08,630 --> 00:08:12,720 So again, users, wall, write. 156 00:08:13,230 --> 00:08:14,494 You can log into three 157 00:08:14,532 --> 00:08:16,262 different sessions, try these commands. 158 00:08:16,286 --> 00:08:19,682 It's going to be fun writing back and forth. 159 00:08:19,826 --> 00:08:24,334 And if you're already in an environment, you're working with 160 00:08:24,432 --> 00:08:27,454 a corporate, you could type the write messages to other 161 00:08:27,492 --> 00:08:29,419 users just to try out, just for fun. 162 00:08:29,419 --> 00:08:30,784 [No audio]