BECOME ROOT! ish... (Linux+ Objective 2.4.2)

Поделиться
HTML-код
  • Опубликовано: 28 июн 2024
  • With Linux you can escalate to root privilege in a number of ways. The traditional "su" command requires that you know the root password, so it's rarely used by itself. Thankfully, both "sudo" and "pkexec" can escalate privilege for a regular user, even though they both approach the "rules" from different angles.
    In this video we learn to use and configure both methods, and I make it clear that I've almost never used "pkexec" in real life. But you do you. :)
    The CompTIA Linux+ objectives are available here: snar.co/plusobjectives
    WAYS TO SUPPORT SHAWN
    ---------------------------------------------
    Patreon: / shawnp0wers
    Merch: store.nerdlings.net
    SuperStickers, etc!
    WAYS TO SUPPORT EACH OTHER
    -------------------------------------------------------
    1) Be Kind
    2) Answer comments/questions here
    3) Ask/Answer questions on our Discord: snar.co/discord
    WAYS TO FIND SHAWN OTHER PLACES
    ----------------------------------------------------------------
    Landing Page: shawnp0wers.com
    #linux #comptia #security
  • НаукаНаука

Комментарии • 14

  • @marklalonde8194
    @marklalonde8194 11 месяцев назад +2

    those videos are gold !! Thank you for keeping updating the series you really help

    • @shawnp0wers
      @shawnp0wers  9 месяцев назад

      Glad you enjoy it! Thank you!

  • @Jeffsa12
    @Jeffsa12 11 месяцев назад +1

    Informative vid Shawn!
    An FYI: On a Linux distro that does not or minimally makes or changes configs, ie: Arch, visudo uses vi as editor out of the box. You can either setup VISUAL editor variable for root, or what I've got into the habit of doing is calling the EDITOR var on the cli: EDITOR=nano visudo.
    I've got into the habit of using pkexec for GUI stuff, and still use sudo on the cli. Also, pkexec is strange in some unexpected ways. ie: changes $PATH

    • @shawnp0wers
      @shawnp0wers  9 месяцев назад

      I appreciate that, and mostly it just makes me chuckle when the default editor is nano when I launch visudo. But you are correct, for sure.
      pkexec is indeed odd, but again you're right it seems to do well with GUI programs. :)

  • @ManeelxAkosAdor
    @ManeelxAkosAdor 11 месяцев назад +1

    You rock man! I am learning a lot with you

  • @samplesandtests
    @samplesandtests 11 месяцев назад

    if i want to make it so a user can run several different programs as sudo with out a password, do i do each program on it's own line or can i use a comma separated list? for example if i want them to be able to use fairly non destructive commands without a password (ls, cat , etc) but all others (vi, nano, apt) where they could change something i want the password prompt (to avoid scripts running commands as root without prompting). i know this question is as clear as mud so if you need me to rephrase let me know

    • @shawnp0wers
      @shawnp0wers  11 месяцев назад

      I think both ways might work. I know you can make a comma separated list of commands as the last field. I'm not sure what multiple lines would do, like how priority works, if one would cancel out the previous, etc.

  • @MrMarcLaflamme
    @MrMarcLaflamme 10 месяцев назад

    Quick note to viewers - sometimes the sudo group is called wheel, not sudo.
    Also have a couple of questions for you.
    In Sudoers, what is the difference between members of admin may gain root privs and members of group sudo can execute any command?
    Typically when I would use su - is when I need to do multiple related tasks that all require escalation and just doing them as the root user eliminates the amount of times I need to type sudo (or sudo !! because I will inevitably forget! haha). Sometimes I've found that running certain scripts as sudo will fail because there are multiple things that run and sudo only seems to elevate the first command (how can I get around this?) Is there a way to enter into an elevated mode (like root) with your user account for a time and then exit when no longer needed? It's funny, I used to hate needing to run PowerShell as Administrator because they didn't have sudo but it's actually useful for instances like what I was describing.

    • @shawnp0wers
      @shawnp0wers  9 месяцев назад +1

      Yeah, the multi-step thing can get frustrating when trying to do things "the right way" and use sudo instead of becoming the root user. Often, it's when a command has to open another shell to accomplish something, but occasionally I can't figure out why a command (or string of commands) fails. In those cases, I too just "become root" and do the command.
      I either do "sudo su -" or someone mentioned "sudo -i" will give you an interactive root shell. But I feel your pain!
      (And thanks for mentioning the wheel/sudo/admin group thing, different distros do handle admin privileges differently)

    • @MrMarcLaflamme
      @MrMarcLaflamme 9 месяцев назад

      @@shawnp0wers Well at least there's something comforting in knowing even the experts have this same dilemma! haha

  • @scottb4029
    @scottb4029 10 месяцев назад

    I know that doas is a BSD thing, but several Linux distros are using it now, when are they going to include it on the test?

    • @shawnp0wers
      @shawnp0wers  9 месяцев назад

      I've honestly never heard of doas!

  • @user-gx4hv3sv7u
    @user-gx4hv3sv7u 10 месяцев назад

    Sudooooo lol