On 19.08.2023 15:08, jdd@dodin.org wrote:
Le 19/08/2023 à 11:57, Yamaban a écrit :
Trick is to "encapsulate" the command in question in a dedicated script and call that.
%><-- Begin of file /root/bin/makeroot #!/usr/bin/bash exec /usr/bin/sudo -i %><---End of file /root/bin/makeroot
the exec is not even necessary :-), and better make it in /home/jdd/bin/
Create that file, make it executeable and create a sudoers line for it. e.G.: jdd ALL=(ALL:ALL) NOPASSWD: /root/bin/makeroot
ok (I named it makeroot.sh)
jdd ALL = (ALL:ALL) NOPASSWD: /home/jdd/bin/makeroot.sh
and then as jdd "sudo /home/jdd/bin/makeroot.sh" worked (makes me root)
That is rather roundabout way of doing sudo sudo -i
then
alias mr="sudo /home/jdd/bin/makeroot.sh"
did the trick (mr works)
I had only to add this alias line in .bashrc to make it permanent
I guess there may be a simpler solution, but it works... so
thanks all :-) jdd