0

I heard that its not ok to run stuff always with sudo, because its same like running stuff as administrator on other os. Is it possible to revert it and un-sudo it so it dont have root access?

Thastertyn
  • 13
  • 4
  • 1
    Can you give us a more concrete example of the problem? – user535733 Apr 28 '20 at 20:25
  • You can always close the app and re-run it without sudo privileges. – zx485 May 01 '20 at 22:57
  • Related: [Why should users never use normal sudo to start graphical applications?](https://askubuntu.com/questions/270006/why-should-users-never-use-normal-sudo-to-start-graphical-applications) – Melebius May 05 '20 at 10:26
  • 1
    What happens if you just run the command without `sudo` ? Commands don't remember that they been run with sudo earlier. – Soren A May 05 '20 at 10:29

1 Answers1

2

There is no need to revert anything.

If you run a command prepending sudo, you'll run the command with root privileges.

If you run a command without sudo, you'll run the command with your user privileges.

Example:

$ sudo ls -a /root
[sudo] password for mook: 
.  ..  .bash_history  .bashrc  .cache  .local  .profile  .synaptic
~$ ls -a /root
ls: cannot open directory '/root': Permission denied

In this example I use the command ls -a /root, first with sudo, then without sudo. As you can see, in the second command I don't have root-access and get a permission denied, even if I have used the same command with sudo before.

Melebius
  • 11,121
  • 8
  • 50
  • 77
mook765
  • 14,911
  • 5
  • 35
  • 67
  • Some apps/programs/commands need sudo to run well. Should not use sudo to open programs that do not need it, like firefox. Sudo apps should only run for short periods of time and be ended, sudo also usually has a set time before needing to be given again, you give a command with sudo and do not use another command within a few minutes, will need password again. – crip659 Apr 28 '20 at 21:02
  • @crip659 `sudo also usually has a set time before needing to be given again` No, the time (usually15 min) is the time you don't need to enter the password when using sudo again within that time. Running a command without `sudo` will never evaluate privileges. – mook765 Apr 28 '20 at 21:19
  • 1
    @mook765 "will never evaluate privileges" in the last comment should be "will never **elevate** privileges" – karel Apr 29 '20 at 01:05
  • @karel Yes, sure. – mook765 Apr 29 '20 at 05:46