0

I've got a group (let's say name "group1", ID = 1234) and a user (let's say name "user1", ID="4321"). I want to do two things:

  1. I want that user to change passwords from other members of that group, but only from that group.
  2. I want every member of that group to be able to use reboot/poweroff commands without using their password every time.

I have read that page (https://help.ubuntu.com/community/Sudoers) but I am still not able to work out my problems.

  • Hi! I marked Ask Ubuntu post for deletion. So it should be okey now. – John Jan 9 '15 at 10:08
  • Your question would be welcomed better if you posted your attempts and how they failed. Then, it would probably be easier for us to understand how your problem could be worked-around/handled ;) – John WH Smith Jan 9 '15 at 11:17
1

Suppose the group id is "foo"

using visudo to change sudo settings:

The % symbol identifies a group

%foo ALL = (root) /usr/bin/reboot

As to password changes you will have to use a script that limits activity - sudo cannot do it all.

Suppose the one special user is peewee Using visudo add:

User_Alias SPECIAL peewee

SPECIAL ALL = (root) NOPASSWD: /root/special_passwd.shl

As root:

mkdir /root
chmod 750 /root

This is completely untested: name this script special_passwd.shl, place it in the root directory. Permissions = 750

#!/bin/bash
if [ $# -eq 2 ] ; then
# echo username:passwd | chpasswd is the syntax
   grp=$(/usr/bin/id -g "$1")
   if [ "$grp" = "1234" ]; then
         echo ${1}:${2} | /usr/bin/chpasswd
      [ $? -eq 0 ] || echo 'password change failed'
   fi

else
   echo 'No password change: requires username, new password'
fi

You should consider showing what you've tried on this. The script is a starter, not meant for production.

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.