Linux Crash Course - sudo

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 มิ.ย. 2024
  • 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 LPI Linux Essentials Course Available
    Check out the new course on Udemy! ➜ learnlinux.link/lpi-course
    ➜ learnlinux.link/lpi-course
    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 TH-cam 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
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 83

  • @CjqNslXUcM
    @CjqNslXUcM 2 ปีที่แล้ว +16

    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 ปีที่แล้ว +30

    I've been a Linux user for 15 years without knowing some of the basics you're teaching. Thank you!

  • @BigBlueMotors
    @BigBlueMotors 2 ปีที่แล้ว +5

    Love your Linux lessons - straight to the point without a lot of fluff. 👍 Fever distractions.

  • @12Q46HPRN
    @12Q46HPRN 2 ปีที่แล้ว +24

    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 ปีที่แล้ว +3

    I'm using sudo for many years now. Thanks to your video I'm understanding the /etc/sudoers file for the first time.

  • @n0madfernan257
    @n0madfernan257 2 ปีที่แล้ว +3

    Channel underrated. Thanks for these lectures.

  • @ObsidianMercian
    @ObsidianMercian 2 ปีที่แล้ว +1

    Awesome video as usual, I love this series. Thanks Jay!

  • @slaxmax9219
    @slaxmax9219 6 วันที่ผ่านมา

    It never gets to old ;)

  • @user-hq5en9qp5u
    @user-hq5en9qp5u 4 หลายเดือนก่อน

    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

  • @nirabhmani9523
    @nirabhmani9523 ปีที่แล้ว +1

    sudo -l command as well as visudo with different options of fixing the sudo file was fantastic!! 😃

  • @mila-sz7lz
    @mila-sz7lz 2 ปีที่แล้ว +6

    I think you have the most, if not the only, useful linux channel. Thank you man 🙏

  • @jofastuff
    @jofastuff 2 ปีที่แล้ว +8

    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.

  • @DL-xf3ur
    @DL-xf3ur 2 ปีที่แล้ว

    Thank you as always Jay! You're the best.

  • @framebrain
    @framebrain 8 หลายเดือนก่อน

    Thanks Jay! Great content

  • @radioactive828
    @radioactive828 5 หลายเดือนก่อน

    THANK YOU THANK YOU THANK YOU! Really saved me SO much trouble! Subbed!

  • @froid_san
    @froid_san 2 ปีที่แล้ว +1

    Great video! Now the thing i put or edit on sudoers files makes more sense. Hope in the future you tackle ACL.

  • @GuardianApe
    @GuardianApe 2 ปีที่แล้ว +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 ?

  • @relytheone853
    @relytheone853 8 หลายเดือนก่อน

    More videos like this, please!

  • @darklinux_
    @darklinux_ 6 หลายเดือนก่อน

    Very very good your explain. Thanks a lot

  • @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++++

  • @x91w
    @x91w 2 ปีที่แล้ว +1

    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

  • @noonewhocares654
    @noonewhocares654 7 หลายเดือนก่อน

    excelent!

  • @Im.Tabachnik
    @Im.Tabachnik 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +5

    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 ปีที่แล้ว +1

    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.)

  • @evodefense
    @evodefense 6 หลายเดือนก่อน

    thx

  • @abdulqayyumshah9217
    @abdulqayyumshah9217 2 ปีที่แล้ว

    Great

  • @catupeloco
    @catupeloco ปีที่แล้ว

    I'll leave the video with something New. Sudo !! Is a good one

  • @mahsumsaetgareev
    @mahsumsaetgareev 2 ปีที่แล้ว +1

    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?

  • @NoEgg4u
    @NoEgg4u 2 ปีที่แล้ว +4

    @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 ปีที่แล้ว +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.

  • @shkjuy6935
    @shkjuy6935 2 ปีที่แล้ว +1

    Thnx

  • @TheExard3k
    @TheExard3k 2 ปีที่แล้ว +1

    neofetch next? :)

  • @LeonardoMarioMartinez
    @LeonardoMarioMartinez 2 ปีที่แล้ว +1

    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.

  • @CeeTheJay
    @CeeTheJay ปีที่แล้ว +2

    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? :)

  • @Liam_Tomhet
    @Liam_Tomhet ปีที่แล้ว +1

    @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 4 วันที่ผ่านมา

      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 4 วันที่ผ่านมา

      @@hvacmisadventures best practice is to leave it unless required otherwise.

    • @hvacmisadventures
      @hvacmisadventures 4 วันที่ผ่านมา

      @@Liam_Tomhet thanks man 🫡

  • @TMavC5
    @TMavC5 2 ปีที่แล้ว

    I like to see ESXI with VM of Ubuntu GPU passthrough in this channel.

  • @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 ปีที่แล้ว +2

      Fira Code, I guess

    • @andrewmunro8830
      @andrewmunro8830 2 ปีที่แล้ว +1

      @@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?

  • @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?

  • @jayvuillermin1414
    @jayvuillermin1414 19 วันที่ผ่านมา

    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

  • @richardkruse4663
    @richardkruse4663 29 วันที่ผ่านมา

    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!)

  • @darren537
    @darren537 2 ปีที่แล้ว +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

  • @jothamsia
    @jothamsia 7 หลายเดือนก่อน

    Is it possible to make specific sudo commands to require password

  • @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?

  • @temoshee7477
    @temoshee7477 2 ปีที่แล้ว +1

    Why is the 'jay' user not in the sudoers file?

    • @TheDillio187
      @TheDillio187 2 ปีที่แล้ว +3

      jay is a member of the sudoers group

  • @ravitejareddy3818
    @ravitejareddy3818 ปีที่แล้ว

    Is this for linux admin?

  • @JefferyOwusu-ft8ci
    @JefferyOwusu-ft8ci 18 วันที่ผ่านมา

    how do i set password to my root when using ssh root@ip

  • @belldiogbo2193
    @belldiogbo2193 2 ปีที่แล้ว

    How can I reach you I need to get some more lesson on linode

    • @LearnLinuxTV
      @LearnLinuxTV  2 ปีที่แล้ว +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?

  • @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

  • @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 ปีที่แล้ว +1

      @@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"

  • @mramosch
    @mramosch ปีที่แล้ว

    Created a ‘tux’ user without any further changes and this user can reboot the machine running RaspberryOS - That doesn’t seem appropriate…

  • @semikolondev
    @semikolondev 2 ปีที่แล้ว +2

    Sudo win lottery

  • @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 หลายเดือนก่อน

      As root "apt install sudo"
      Edit: replace apt with your package manager dnf pacman etc