Linux Crash Course - sudo

  Рет қаралды 63,935

Learn Linux TV

Learn Linux TV

Күн бұрын

When you need to run Linux commands with elevated privileges, sudo is the tried and true method to run commands as another user (such as root). In this introductory tutorial, we'll take a look at some of the inner-workings of sudo.
Brand New Udemy Courses Available!
Check out my new courses on Udemy and take your learning even further!
• Ansible Course ➜ learnlinux.link/ansible
• Linux Essentials Course ➜ learnlinux.link/linux-essentials
Check out the Linux Shop
In the official shop, you'll find Shirts, hats, stickers, bags and more!
➜ merch.learnlinux.tv
5% discount on LPI exam vouchers
After you finish Jay's new course, get 5% off an LPI exam voucher here:
➜ learnlinux.link/lpi-voucher
Become a Patron
Show your support for Learn Linux TV on Patreon and get access to exclusive perks!
➜ learnlinux.link/patron
Become a Channel Member
Show your support for Learn Linux TV here on KZfaq and get access to exclusive perks!
➜ learnlinux.link/member
Mastering Ubuntu Server: 4th Edition
Jay's latest book covers everything you need to know in order to master Ubuntu Server. It's available here:
➜ ubuntuserverbook.com
Linux Gear and Kits
Check out Jay's choice of hardware products, audio/video equipment, and more.
➜ learnlinux.link/amazon
Grab an awesome Pi-powered KVM
Support Learn Linux TV and grab yourself a TinyPilot KVM here:
➜ learnlinux.link/tinypilot
Note: Royalties and/or commission is earned from each of the above links
Time Codes
00:00 - Intro
02:44 - sudo overview
04:12 - Notes about installing sudo
05:01 - The sudo group
07:52 - Listing sudo privileges
09:00 - What to do when you forget to use sudo
10:22 - The /etc/sudoers file
14:57 - Editing the /etc/sudoers file with visudo
17:43 - Restricting sudo to specific commands
20:23 - sudo without a password
22:32 - Undoing errors while using visudo
Full Courses from Learn Linux TV
• Linux Essentials Certification Workshop ➜ learnlinux.link/lpi-course
• Linux Crash Course series ➜ linux.video/cc
• Learn how to use tmux ➜ linux.video/tmux
• Learn how to use vim ➜ linux.video/vim
• Bash Scripting Series ➜ linux.video/bash
• Proxmox VE Cluster Full Course ➜ linux.video/pve
• Learn Ansible ➜ linux.video/ansible
Linux-related Podcasts
• Enterprise Linux Security ➜ enterpriselinuxsecurity.show
• The Homelab Show ➜ thehomelab.show
Learn Linux TV on the Web
• Main site ➜ www.learnlinux.tv
• Community ➜ community.learnlinux.tv
• Enterprise Linux Security Podcast ➜ enterpriselinuxsecurity.show
• The Homelab Show Podcast ➜ thehomelab.show
• Content Ethics ➜ www.learnlinux.tv/content-ethics
• Request Assistance ➜ www.learnlinux.tv/request-ass...
Disclaimer
Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. The person viewing Learn Linux TV's content is expected to follow their best judgement and to make their best decisions while working with any related technology. Always make sure you have written permission before working with any infrastructure. Also, be sure that you're compliant with all company rules, change control procedures, and local laws.
#Linux #DevOps #sudo

Пікірлер: 84
@CjqNslXUcM
@CjqNslXUcM 2 жыл бұрын
9:43 another good tip is: !* is all arguments from the last command (not the command itself), super useful if you want to do a bunch of things to the same files !:1 is the first argument !:2 the second etc.. !:1-3 group of arguments !$ last argument !:0 the command only (0th argument)
@OferSadan85
@OferSadan85 2 жыл бұрын
I've been a Linux user for 15 years without knowing some of the basics you're teaching. Thank you!
@relytheone853
@relytheone853 9 ай бұрын
Me too!!!
@n0madfernan257
@n0madfernan257 2 жыл бұрын
Channel underrated. Thanks for these lectures.
@ObsidianMercian
@ObsidianMercian 2 жыл бұрын
Awesome video as usual, I love this series. Thanks Jay!
@BigBlueMotors
@BigBlueMotors 2 жыл бұрын
Love your Linux lessons - straight to the point without a lot of fluff. 👍 Fever distractions.
@12Q46HPRN
@12Q46HPRN 2 жыл бұрын
Outstanding as always. I've been a Linux user for a few years now, but I always learn something from your videos. Thank you so much!
@Ollital
@Ollital 2 жыл бұрын
I'm using sudo for many years now. Thanks to your video I'm understanding the /etc/sudoers file for the first time.
@user-hq5en9qp5u
@user-hq5en9qp5u 5 ай бұрын
hey , i just wanna say that your videos are so informative and easy to grasp ,especially for a beginner like me who is still tyring to learn the ABc of linux , a huge thanks buddy
@jofastuff
@jofastuff 2 жыл бұрын
Very informative video as usual, however, please note that allowing sudo access to apt (like in the example at @18:20) makes it trivially easy to escalate into a root shell (by appending -o APT::Update::Pre-Invoke::="/bin/bash" as an argument) and thus should be avoided.
@nirabhmani9523
@nirabhmani9523 Жыл бұрын
sudo -l command as well as visudo with different options of fixing the sudo file was fantastic!! 😃
@mila-sz7lz
@mila-sz7lz 2 жыл бұрын
I think you have the most, if not the only, useful linux channel. Thank you man 🙏
@framebrain
@framebrain 9 ай бұрын
Thanks Jay! Great content
@radioactive828
@radioactive828 5 ай бұрын
THANK YOU THANK YOU THANK YOU! Really saved me SO much trouble! Subbed!
@DL-xf3ur
@DL-xf3ur 2 жыл бұрын
Thank you as always Jay! You're the best.
@LearnLinuxTV
@LearnLinuxTV 2 жыл бұрын
You are!
@slaxmax9219
@slaxmax9219 13 күн бұрын
It never gets to old ;)
@froid_san
@froid_san 2 жыл бұрын
Great video! Now the thing i put or edit on sudoers files makes more sense. Hope in the future you tackle ACL.
@darklinux_
@darklinux_ 6 ай бұрын
Very very good your explain. Thanks a lot
@relytheone853
@relytheone853 9 ай бұрын
More videos like this, please!
@guypartush2976
@guypartush2976 7 ай бұрын
Dear Jay thank you very much for all your work and effort educating us with your vast knowledge. I am making my first cybersecurity steps and your videos are an enormous help!
@LearnLinuxTV
@LearnLinuxTV 7 ай бұрын
I’m glad my videos are a great help to you. Thank you so much for your kind comment.
@amanwehib8367
@amanwehib8367 2 жыл бұрын
Clear and concise!!!!!!!!!!!
@kiasalimi5108
@kiasalimi5108 4 ай бұрын
thank you for the content, A++++
@GuardianApe
@GuardianApe 2 жыл бұрын
I love you man , thank you so much for these videos. I have a question. In what order am I to go through the Linux essentials playlist ?
@noonewhocares654
@noonewhocares654 7 ай бұрын
excelent!
@Im.Tabachnik
@Im.Tabachnik 2 жыл бұрын
I love the way you teach, and I learn from you a lot, Thank you for all the great investment. and I will happy if you can create a video about NFS share from Linux to Linux\Windows.
@Dean-vd5wr
@Dean-vd5wr 2 жыл бұрын
Great video Jay. I am a newbie, and I'm still trying to understand the commands in the terminal.
@AliTwaij
@AliTwaij Жыл бұрын
excellent thabkyou
@skug978
@skug978 2 жыл бұрын
As a Linux SysAdmin, I avoid using "sudo" for admin of Linux systems. With Debian Linux, "sudo" is not active by default, and the distro expects you to use the "root" account for maintenance. The preferred usage for "sudo" is for giving some elevated privileges to specific users, as you demonstrated. However, "sudo" isn't needed for working on Linux, and it comes down to preference - I feel you should have made that clear in your video. (I do agree that the root account shouldn't be accessible remotely, i.e. you need to logon to the machine as a regular user, then use "su -" to gain root after that.)
@NoEgg4u
@NoEgg4u 2 жыл бұрын
@20:50 -- "NOPASSWD" What if there were some commands where you do not want to be asked for a password, and other commands where you do want to be asked for the password? How would that syntax be laid out in the sudoers file?
@d00dEEE
@d00dEEE 2 жыл бұрын
Just add multiple lines, one with NOPASSWD and the other without. There might be ordering issues, so try it and if it doesn't work one way, swap the NOPASSWD line before or after the other one for a given user.
@Indigenous_Patriot_1175
@Indigenous_Patriot_1175 5 күн бұрын
I am new to Linux and Im loving your content. I am interested in running Arch Linux. I just watched this video and I notice while going along that visudo is not found in Arch.
@x91w
@x91w 2 жыл бұрын
Jay, as usual nice presentation. The problem I found when working was big companies like IBM saying "MQ/DB2/WAS/etc can only be updated from root NOT sudo" and we had a method to temporarily change root, turn on insane syslog give it to IBM and change it back after and hope they hadn't installed some pkexec.c elevation stuff. How would you approach that problem ? Thankfully I'm now retired
@evodefense
@evodefense 6 ай бұрын
thx
@catupeloco
@catupeloco Жыл бұрын
I'll leave the video with something New. Sudo !! Is a good one
@shkjuy6935
@shkjuy6935 2 жыл бұрын
Thnx
@LearnLinuxTV
@LearnLinuxTV 2 жыл бұрын
My pleasure :)
@LeonardoMarioMartinez
@LeonardoMarioMartinez 2 жыл бұрын
Another interesting thing is the use of the /etc/sudoers.d/ directory for custom setup. It's a more clear aproach and a better way to manage users and groups privileges.
@TMavC5
@TMavC5 2 жыл бұрын
I like to see ESXI with VM of Ubuntu GPU passthrough in this channel.
@abdulqayyumshah9217
@abdulqayyumshah9217 2 жыл бұрын
Great
@Liam_Tomhet
@Liam_Tomhet Жыл бұрын
@10:20 as he stated: normally you would not edit/modify that file. Not sure if the same for arch linux. But in artix linux it is required modify that file to uncomment (delete #) the wheel group to allow sudo in that group.
@hvacmisadventures
@hvacmisadventures 11 күн бұрын
I know it’s been a year since you commented but if you see this … That was a question I had: what is the best practice? Is it best to just add users to sudo group and leave the file alone except for special circumstances?
@Liam_Tomhet
@Liam_Tomhet 11 күн бұрын
@@hvacmisadventures best practice is to leave it unless required otherwise.
@hvacmisadventures
@hvacmisadventures 11 күн бұрын
@@Liam_Tomhet thanks man 🫡
@CeeTheJay
@CeeTheJay Жыл бұрын
I've always pronounced it "pseudo," assuming it was GNU-style wordplay. It's a fake super user account, therefore: 'pseudo' (sudo). Does anyone else think of it this way? :)
@mahsumsaetgareev
@mahsumsaetgareev 2 жыл бұрын
I am new to linux, so I am sorry if I ask silly question. Isn't there a user jay in the system and if so shouldn't information about it be in sudoers?
@TheExard3k
@TheExard3k 2 жыл бұрын
neofetch next? :)
@darren537
@darren537 2 жыл бұрын
Thanks! Can you please do an install and walk through of EndeavorOS for beginners that are interested in ARCH,pacman and the AUR but are intimidated by the are way installation?
@systemuser9636
@systemuser9636 2 жыл бұрын
@Darren hey man I just switched from Ubuntu to Endeavour. That would be a great video.
@rahilarious
@rahilarious 2 жыл бұрын
i think this channel is more targeted towards server linux than desktop. For arch content u should ermano ferrari
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 2 жыл бұрын
Anyway, if you do sudo, somehow it will consider your home directory as /root, how can I keep it as /home/user?
@andrewmunro8830
@andrewmunro8830 2 жыл бұрын
Newish to Linux and I'm sure I should have more insightful questions by now, but what I really want to know is ... what's the font in your terminal emulator? I really like the @ symbol!
@adaum79
@adaum79 2 жыл бұрын
Fira Code, I guess
@andrewmunro8830
@andrewmunro8830 2 жыл бұрын
@@adaum79 Amazing, thanks!
@zeppelinmexicano
@zeppelinmexicano 4 ай бұрын
With regard to that botched sudoers file, does the errant "ALL" affect just user tux, or is the file then just botched for all use?
@jothamsia
@jothamsia 7 ай бұрын
Is it possible to make specific sudo commands to require password
@richardkruse4663
@richardkruse4663 Ай бұрын
I know this is old, but what's new is that in Debian-12, neither the 'adduser' command nor the 'usermod' command is available.even as 's -'. Any comment? (I enjoy your 'Learn Linux TV' posts!)
@jayvuillermin1414
@jayvuillermin1414 26 күн бұрын
Hey Jay, I love your content bro, sorry, this is a bit unrelated, but while watching this video I was playing around and I ran HTOP and grepped for systemd on kali 2024. I slowed my system right down which I can't say I was surprised by. So I thought after a few seconds, I'll Control+C out of this. I did and all was well. I sort of accidentally knocked my mouse and noticed something odd. I noticed that the terminal started printing what I believe was my wireless mouse' current position in some kind of code (coordinates) that constantly changed depending on where I'd move the mouse. I'm a noob. I listen and watch and re-watch again and again to cement it in my head which is what I was doing (listening to you) while doing something else when I noticed this. Could just be my system. Maybe you can replicate it? Maybe you're already well aware of it? Maybe it's nothing? To me it was odd. I know to you it'll be nothing new but it was really interesting mate. Hey, thanks for the time you take and the energy you put in to educate and help others! We need more folks like you mate. Cheers
@temoshee7477
@temoshee7477 2 жыл бұрын
Why is the 'jay' user not in the sudoers file?
@TheDillio187
@TheDillio187 2 жыл бұрын
jay is a member of the sudoers group
@cristoforopontikas
@cristoforopontikas 2 жыл бұрын
Hello, great video but i would like to mention that the last command for the NOPASSWD isn’t correct. I have give it a try and verify that the correct line to type is the next one. Suppose the user is called chris chris ALL=(ALL) NOPASSWD:ALL if you type as you describe then it want work. Al least on Raspberry os 64 bit latest official release chris ALL=(ALL:ALL) NOPASSWD: This will not work. Why?
@ravitejareddy3818
@ravitejareddy3818 Жыл бұрын
Is this for linux admin?
@JefferyOwusu-ft8ci
@JefferyOwusu-ft8ci 25 күн бұрын
how do i set password to my root when using ssh root@ip
@mramosch
@mramosch Жыл бұрын
Created a ‘tux’ user without any further changes and this user can reboot the machine running RaspberryOS - That doesn’t seem appropriate…
@belldiogbo2193
@belldiogbo2193 2 жыл бұрын
How can I reach you I need to get some more lesson on linode
@LearnLinuxTV
@LearnLinuxTV 2 жыл бұрын
There's a "request assistance" page on the main website. But I'm already working on new Linode content, so it's possible that content might already address your question.
@efeley44
@efeley44 2 жыл бұрын
Guys help!!!!! When I try to put my password, it says password invalid. I don't why tho cuz it's literally is my account password, what should I do?
@Steamrick
@Steamrick 2 жыл бұрын
Sudo? The thing that CVE-2021-4034 has made superfluous?
@LearnLinuxTV
@LearnLinuxTV 2 жыл бұрын
Unless I'm misunderstanding your comment, that CVE specifically refers to polkit not sudo. Unless you're referring to a vulnerability chain, but vulnerabilities and chaining vulnerabilities is not uncommon.
@Steamrick
@Steamrick 2 жыл бұрын
@@LearnLinuxTV I was basically referring to a comment in the Veeam Newsletter (formally "Veeam R&D Forums Digest"), trying to poke some fun: "Another way to look at it: that sudoers file was completely optional for the past 12 years, as anyone in the know could just run any command as root"
@semikolondev
@semikolondev 2 жыл бұрын
Sudo win lottery
@TheDillio187
@TheDillio187 2 жыл бұрын
Get in line, lol.
@El_Bartto
@El_Bartto 6 ай бұрын
using linux for the first time, sudo asks me for a password, which password is that? the one that I use to log in or the super user one?
@jagadeesh9074
@jagadeesh9074 4 ай бұрын
the one that use to log in
@bernard1475
@bernard1475 2 жыл бұрын
doas* ;p
@jeremybarlow2291
@jeremybarlow2291 2 жыл бұрын
sudo apt install doas, sudo dnf install doas, or sudo pacman -S doas is what I've heard is the best use of sudo.
@fsxspen
@fsxspen Жыл бұрын
Q is a stupid option
@tacticaldepartment1929
@tacticaldepartment1929 2 жыл бұрын
can you tich me sir linux
@vampiregoat69
@vampiregoat69 3 ай бұрын
So you don't tell people how to install sudo since you have it already that is a bit messed up I thought this was LEARNING to do not I have it already if you don't tough sht
@SR-mj9ei
@SR-mj9ei 2 ай бұрын
As root "apt install sudo" Edit: replace apt with your package manager dnf pacman etc
Linux Crash Course - htop
16:43
Learn Linux TV
Рет қаралды 43 М.
Linux Crash Course - Data Streams (stdin, stdout & stderr)
17:13
Learn Linux TV
Рет қаралды 50 М.
бесит старшая сестра!? #роблокс #анимация #мем
00:58
КРУТОЙ ПАПА на
Рет қаралды 3,3 МЛН
OMG😳 #tiktok #shorts #potapova_blog
00:58
Potapova_blog
Рет қаралды 4,1 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 9 МЛН
OMG🤪 #tiktok #shorts #potapova_blog
00:50
Potapova_blog
Рет қаралды 17 МЛН
Linux Command-Line Tips & Tricks: Over 15 Examples!
31:37
Learn Linux TV
Рет қаралды 213 М.
Why "sudo" when you can just "su"?
10:39
DistroTube
Рет қаралды 29 М.
Linux Crash Course - Symbolic Links
30:07
Learn Linux TV
Рет қаралды 59 М.
Linux Crash Course - Understanding File & Directory Permissions
35:48
Learn Linux TV
Рет қаралды 111 М.
ChatGPT Just Learned To Fix Itself!
5:47
Two Minute Papers
Рет қаралды 22 М.
How SSH Works
8:54
Mental Outlaw
Рет қаралды 488 М.
10 Typical Linux Problems and How to Fix Them
23:45
Learn Linux TV
Рет қаралды 63 М.
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,4 МЛН
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
Low Price Best 👌 China Mobile 📱
0:42
Tech Official
Рет қаралды 719 М.
#miniphone
0:16
Miniphone
Рет қаралды 3,7 МЛН
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33
Ремонтяш
Рет қаралды 310 М.