recentpopularlog in

kme : sudo   21

Liam O 🦆 on Twitter: "Favourite thing in my .bashrc remains: alias fuck='sudo $(history -p !!)'"
Also note that this will (probably) not work with quoted arguments.
<code class="language-bash">
alias fuck='sudo $(history -p !!)'
unix  linux  sysadmin  sudo  bashrc  fuckups  humor 
9 weeks ago by kme
shell - Redirecting stdout to a file you don't have write permission on - Unix & Linux Stack Exchange |
Yes, using tee. So echo test > /tmp/foo becomes
<code class="language-bash">echo test | sudo tee /tmp/foo</code>

You can also append (>>)
<code class="language-bash">echo test | sudo tee -a /tmp/foo</code>
bash  sudo  shellscripting  redirection  dammitbrain  solution 
may 2018 by kme
shell - How do I use redirection with sudo - Unix & Linux Stack Exchange |
I prefer the solution using 'tee' mentioned at
An alternative way to do this, is to wrap the entire command in another bash command shell:

<code class="language-bash">sudo bash -c "cat .mplayer/config >> /home/griff/.mplayer/config"</code>
bash  sudo  shellscripting  redirection  sortof  solution 
may 2018 by kme
How does the vim "write with sudo" trick work? - Stack Overflow |
Many of you have probably seen the command that allows you to write on a file that needs root permission, even when you forgot to open vim with sudo:

:w !sudo tee %

The thing is that I don't get what is exactly happening here.
vim  tipsandtricks  sudo  sysadmin  textediting 
november 2017 by kme
authentication - lxqt polkit asking for root's password when account is locked - Super User
This actually *was* the problem after all. I'd forgotten to add 'vagrant' to the 'sudo' group because he had his own entry in /etc/sudoers.

I managed to get it to work correctly. I wasn't added to the "wheel" group. I fixed it by running:

sudo usermod -a -G wheel [user]

vagrant  sudo  polkit  policykit  ubuntu  xubuntu  annoyance  solution 
may 2016 by kme
How do I increase sudo password remember timeout? - Ask Different
Run sudo visudo and add this line:

Defaults timestamp_timeout=-1

See man 5 sudoers. -1 causes the password to never timeout. You may change the number to whatever you like in minutes.

The man page for sudo says that sudo -v "extends the sudo timeout for another 5 minutes".

Running 'sudo visudo' instead of editing the file directly causes the system to validate the sudoers file before it commits the changes. For instance, if you leave a stray character somwhere, when you save and exit, it will say "there is an error in the sudoers file, what would you like to do?" ... hence giving you a chance to go back in and edit. This actually just happened to me 10 minutes ago.
mac  osx  sudo  authentication  sysadmin  configfile  security 
march 2016 by kme
linux - sudo: no tty present and no askpass program specified -- netbeans - Stack Overflow
The user I was having problems with did actually have a "Defaults:user !requiretty" line in /etc/sudoers, but the actual issue was that the script happened to have a valid username as the *second* argument, and the *first* argument was a filename that wasn't present on the system. So sudo chose to ignore the first argument and consider the second argument as a user to 'sudo' /as/ (I guess).
sudo  sysadmin  errormessage  solution 
january 2015 by kme
Sudoers Manual
The #includedir directive can be used to create a sudo.d directory that the system package manager can drop sudoers rules into as part of package installation. For example, given:

#includedir /etc/sudoers.d

sudo will read each file in /etc/sudoers.d, skipping file names that end in ‘~’ or contain a ‘.’ character to avoid causing problems with package manager or editor temporary/backup files. Files are parsed in sorted lexical order. That is, /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second. Be aware that because the sorting is lexical, not numeric, /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second. Using a consistent number of leading zeroes in the file names can be used to avoid such problems.
Note that unlike files included via #include, visudo will not edit the files in a #includedir directory unless one of them contains a syntax error. It is still possible to run visudo with the -f flag to edit the files directly.

sudo  security  configfile  sysadmin  solution 
january 2015 by kme
linux - How do I use sudo to redirect output to a location I don't have permission to write to? - Stack Overflow
Run a shell with sudo and give the command to it by using the -c option:

sudo sh -c 'ls -hal /root/ > /root/test.out'
solution  shell  sudo  sysadmin  redirection 
september 2014 by kme
Should You Worry About the Mac OS X Sudo Password Bypass Vulnerability | Low End Mac
Wow, that’s a lot of hoops to jump through just to be vulnerable to the attack. Seriously, when is the last time you used sudo on your Lion or Mountain Lion Mac?

Shyeah, like every day.
mac  osx  sudo  vulnerability  bug  solution 
october 2013 by kme

Copy this bookmark:

to read