this post was submitted on 04 May 2025
292 points (98.0% liked)

linuxmemes

25111 readers
1971 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. πŸ‡¬πŸ‡§ Language/язык/Sprache
  • This is primarily an English-speaking community. πŸ‡¬πŸ‡§πŸ‡¦πŸ‡ΊπŸ‡ΊπŸ‡Έ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • Β 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 2 years ago
    MODERATORS
     

    Explanation for newbies: setuid is a special permission bit that makes an executable run with the permissions of its owner rather than the user executing it. This is often used to let a user run a specific program as root without having sudo access.

    If this sounds like a security nightmare, that's because it is.

    In linux, setuid is slowly being phased out by Capabilities. An example of this is the ping command which used to need setuid in order to create raw sockets, but now just needs the cap_net_raw capability. More info: https://unix.stackexchange.com/questions/382771/why-does-ping-need-setuid-permission. Nevertheless, many linux distros still ship with setuid executables, for example passwd from the shadow-utils package.

    you are viewing a single comment's thread
    view the rest of the comments
    [–] unhrpetby 10 points 3 weeks ago* (last edited 3 weeks ago) (3 children)

    The nosuid mount option disables this behavior per mount. Just be sure you don't use suid binaries.

    Example: sudo or doas. I replaced those with switching to a tty with an already open root account on startup. Generally faster and (for me) more secure (you need physical access to get to the tty).

    [–] [email protected] 7 points 3 weeks ago (1 children)

    Does run0 use suid? From my understanding, it shouldn't.

    [–] unhrpetby 4 points 3 weeks ago

    From what I've read, no. Though it doesn't solve the fundamental problem of a root process handling untrusted input from a regular user.

    The TTY method is IMO better as it ties privileges to a piece of physical hardware, bypassing the complexities of userspace elevation of privileges.

    [–] [email protected] 3 points 3 weeks ago (1 children)

    How do you set up the tty method?

    [–] unhrpetby 5 points 3 weeks ago* (last edited 3 weeks ago)

    All I do is have agetty --autologin root tty2 linux run as a service. It launches on startup, and I just hit CTRL + ALT + F2 if I ever need a root shell.

    All its doing is just auto logging-in as root on TTY2.

    [–] [email protected] 1 points 3 weeks ago (1 children)

    So you can't become root on your system unless you switch to that tty? That sounds like a gigantic pain in the ass.

    [–] unhrpetby 1 points 3 weeks ago (1 children)

    Your needs must be different than mine.

    I press one button combination and have root without ever entering a password. I press a similar combination and go back. Not sure how this is a pain in the ass.

    [–] [email protected] 2 points 3 weeks ago (1 children)

    Yea, it sounds pretty nice actually. I'm considering doing that as well. Makes it obvious when you're running in a root shell too which is nice. I'd probably still keep sudo around though.

    With a programmable keyboard it can just be one button too!

    [–] unhrpetby 2 points 3 weeks ago

    You can modify the keybinds in software too. You would need to change your console keymap (TTY) and your desktop environment keybindings. Programmable keyboard is most likely easier though.

    I played around with it and changed both to just use F1 = tty1 and so on, without requiring CTRL+ALT.