Sudo seems not work

[alangea@alangea-systemproductname ~]$ sudo dnf clean all ; dnf clean all ; dnf repolist ; dnf --refresh upgrade
[sudo] password di alangea:
40 file rimossi
0 file rimossi
id repo nome repo
rock-updates-x86_64 OpenMandriva Rock - x86_64 - Updates
rock-updates-x86_64-non-free OpenMandriva Rock - Non-free - x86_64 - Updates
rock-updates-x86_64-restricted OpenMandriva Rock - Restricted - x86_64 - Updates
rock-updates-x86_64-unsupported OpenMandriva Rock - Unsupported - x86_64 - Updates
rock-x86_64 OpenMandriva Rock - x86_64
rock-x86_64-non-free OpenMandriva Rock - Non-free - x86_64
rock-x86_64-restricted OpenMandriva Rock - Restricted - x86_64
rock-x86_64-unsupported OpenMandriva Rock - Unsupported - x86_64
Error: This command has to be run with superuser privileges (under the root user on most systems)

Why sudo command doesnt’ work ?


The command works as it should - note that the ; starts a new command altogether, so what you’re doing there is

sudo dnf clean all [succeeds because you are root]
dnf clean all [fails because you aren’t root]
dnf repolist [succeeds because it doesn’t need root]
dnf --refresh upgrade [fails because you aren’t root]

what you want to do is either

sudo dnf clean all; sudo dnf repolist; sudo dnf --refresh upgrade


sudo bash -c "dnf clean all; dnf repolist; dnf --refresh upgrade"

sudo dnf --refresh upgrade

That’s just what I want to know. Than you for the suggestion.

That’s just what I wanted to know. Than you for the suggestion.