Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Just to show how versatile bash is, here's a way to do what you want without using sudo: create a file as root, let's say /usr/local/update that looks like this:

#! /bin/bash

dnf -y update

Then, still as root, run chmod /usr/local/update +x, +s /usr/local/update which means that anybody can execute the file as though they were the file's owner, allowing them to update your system without needing to enter a password. (I picked /usr/local because it's on the default path.) Which way you use depends on your own personal taste, of course, but I find the above to be a bit more elegant. YMMV and probably does.