Executing commands with root privilege

To execute commands with root privilege, the pamsu command is used similarly to sudo. The difference is that authentication will be requested from the PAM user, and not by the privileged account.

The command with arguments must be preceded by two hyphens. For example:

[administrator@centos7 ~]$ pamsu -- ls -la /etc/ssl
Password for indeed-id\james.miller:
total 12
drwxr-xr-x. 4 root root 68 Sep 22 19:20 .
drwxr-xr-x. 75 root root 8192 Sep 22 17:49 ..
drwxr-xr-x. 2 root root 123 Sep 22 19:30 CA
lrwxrwxrwx. 1 root root 21 Sep 22 15:51 cert.pem -> /etc/pki/tls/cert.pem
lrwxrwxrwx. 1 root root 16 Nov 23 2020 certs -> ../pki/tls/certs
[administrator@centos7su ~]$ 
[administrator@centos7su ~]$ pamsu vi /etc/resolv.conf
  • No labels