I want to initiate zypper command without the entry of sudo. For example,

zypper update

I attempt to change the permission bit of the zypper file located at /usr/bin folder. I assume that with allow me to run the zypper command without sudo command.

-rwxr-sr-x 1 root root 1942112 Oct 10 19:21 /usr/bin/zypper

I added current user to root group; this file should be able to run as root.

  • You made the file setgid, yet group root is just an ordinary group. And adding the current user to group root is useless. Do you understand what the setuid and setgid bits do? – AlexP Dec 2 '17 at 6:08
  • I assume that the file will be ran as root group. which means it can bypass root privelege – vincent pham Dec 2 '17 at 6:14
  • 1
    From where did you get the impression that membership in the group root confers any special privileges? Can you provide a quotation? – AlexP Dec 2 '17 at 6:19
  • strange, I added setuid instead, and it works. I assume that the error is related to root UID. – vincent pham Dec 2 '17 at 6:31
  • 1
    @AlexP Make that an answer so that this question does not look unsolved any more. – Hauke Laging Dec 2 '17 at 8:43

strange, I added setuid instead, and it works.

For a binary to run with root privileges when invoked by any other user, it must be setuid. You can do it as follows:

$ sudo /usr/bin/chmod 4755 /usr/bin/zypper

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.