Find the answer to your Linux question:
Results 1 to 5 of 5
How would you add a password to a certain program, or set a list of users that are the only ones that can run/own the program? For instance if i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2004
    Posts
    50

    adding a password to a specific program


    How would you add a password to a certain program, or set a list of users that are the only ones that can run/own the program? For instance if i wanted only the user "John" to be able to run firefox and keep the user "Bob" from being able to use it. Or promting "Bob" and "John" for a password when they try to run the program. Either one would work, i just don't know how.

  2. #2
    Linux Guru dylunio's Avatar
    Join Date
    Aug 2004
    Location
    Cymru
    Posts
    4,157
    For this example there will be three people: Jason, Dan, and Fred

    You want Jason and Dan to be able to run mozilla for example.

    Firstly create a group mozilla with
    Code:
    groupadd -f mozilla
    Then find the executable file that starts mozilla, e.g. /usr/bin/mozilla next make the group of that executable, mozilla with
    Code:
    chgrp mozilla /usr/bin/mozilla
    next let both the owner and the group be able te execute the file with
    Code:
    chmod 550 /usr/bin/mozilla
    the first 5 gives read and execute permissions to the owner (most likly root), the second 5 gives read and execute rights to anyone in the group 'mozilla'. The last 0 gives no writes to anyone else.

    Now add Jason and Dan to the mozilla group with
    Code:
    usermod -G mozilla Jason
    and
    Code:
    usermod -G mozilla Dan
    (or you can add there names to /etc/groups)

    Now Jason and Dan con use Mozilla but Fred can't

    I hope this helps

    dylunio
    Registered Linux User #371543!
    Get force-get May The Source Be With You
    /dev/null
    /dev/null2

  3. #3
    Just Joined!
    Join Date
    Dec 2004
    Posts
    50
    [root@dellgx1 Me]# groupadd -f gaim
    bash: groupadd: command not found

    ill find the command, if some1 doesnt reply before i do


    EDIT: i found it, it was in the sbin
    "ln -s /usr/sbin/groupadd /usr/bin/groupadd" to fix

    thanks for writing that out for me, musta been alot of work

    it worked after i linked some of the commands that were in the sbin
    thanks again

  4. #4
    Linux Guru dylunio's Avatar
    Join Date
    Aug 2004
    Location
    Cymru
    Posts
    4,157
    I'm glad you have it suttup
    Registered Linux User #371543!
    Get force-get May The Source Be With You
    /dev/null
    /dev/null2

  5. #5
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    You shouldn't really link the programs in sbin to bin -- they are in sbin for a reason.

    Let me guess that you are switching to root by just running `su', is that right? Next time, try running `su -' (i.e. s u space hyphen). That will put the sbin directories in your PATH envvar, so that you can run programs from them directly.

    Alternatively, you can run the program as /usr/sbin/groupadd by typing the entire path explicitly. They don't need to be in a specific directory for you to be able to run them.

    I can also add that you can set a password on a group with the `gpasswd' command. That way, if someone not in the mozilla group wants to temporarily be a part of it and he/she knows its password, he/she can use the command `newgrp mozilla' and type in the password to be able to run it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •