Execute command as a restricted group without entering password

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












I want to prevent some apps from going to network, so I've created a no-internet group:
sudo groupadd -g 9876 no-internet

and created a script
sudo gedit /usr/bin/ni



#!/bin/bash
sg no-internet "$1"


And added an iptable rule



#!/bin/bash
iptables -A OUTPUT -m owner --gid-owner no-internet -j DROP


Now ni my_command should run an app in a restricted mode. However, I am getting sg: failed to crypt password with previous salt: Invalid argument



How can I run an app as 'no-internet group`, without limiting my own access to LAN/WAN?



I've checked this question (claiming that requirements are contradictory)
How to switch a group without asking for a password?



But is it really so?







share|improve this question




















  • is user using ni in no-internet group ?
    – Archemar
    Mar 25 at 13:47










  • I am a user (admin with root rights). I want to run ni untrusted-app in order to prevent this app from talking to internet. I don't want to block my own access to internet though.
    – sixtytrees
    Mar 25 at 22:26














up vote
1
down vote

favorite
1












I want to prevent some apps from going to network, so I've created a no-internet group:
sudo groupadd -g 9876 no-internet

and created a script
sudo gedit /usr/bin/ni



#!/bin/bash
sg no-internet "$1"


And added an iptable rule



#!/bin/bash
iptables -A OUTPUT -m owner --gid-owner no-internet -j DROP


Now ni my_command should run an app in a restricted mode. However, I am getting sg: failed to crypt password with previous salt: Invalid argument



How can I run an app as 'no-internet group`, without limiting my own access to LAN/WAN?



I've checked this question (claiming that requirements are contradictory)
How to switch a group without asking for a password?



But is it really so?







share|improve this question




















  • is user using ni in no-internet group ?
    – Archemar
    Mar 25 at 13:47










  • I am a user (admin with root rights). I want to run ni untrusted-app in order to prevent this app from talking to internet. I don't want to block my own access to internet though.
    – sixtytrees
    Mar 25 at 22:26












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I want to prevent some apps from going to network, so I've created a no-internet group:
sudo groupadd -g 9876 no-internet

and created a script
sudo gedit /usr/bin/ni



#!/bin/bash
sg no-internet "$1"


And added an iptable rule



#!/bin/bash
iptables -A OUTPUT -m owner --gid-owner no-internet -j DROP


Now ni my_command should run an app in a restricted mode. However, I am getting sg: failed to crypt password with previous salt: Invalid argument



How can I run an app as 'no-internet group`, without limiting my own access to LAN/WAN?



I've checked this question (claiming that requirements are contradictory)
How to switch a group without asking for a password?



But is it really so?







share|improve this question












I want to prevent some apps from going to network, so I've created a no-internet group:
sudo groupadd -g 9876 no-internet

and created a script
sudo gedit /usr/bin/ni



#!/bin/bash
sg no-internet "$1"


And added an iptable rule



#!/bin/bash
iptables -A OUTPUT -m owner --gid-owner no-internet -j DROP


Now ni my_command should run an app in a restricted mode. However, I am getting sg: failed to crypt password with previous salt: Invalid argument



How can I run an app as 'no-internet group`, without limiting my own access to LAN/WAN?



I've checked this question (claiming that requirements are contradictory)
How to switch a group without asking for a password?



But is it really so?









share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 2:39









sixtytrees

1062




1062











  • is user using ni in no-internet group ?
    – Archemar
    Mar 25 at 13:47










  • I am a user (admin with root rights). I want to run ni untrusted-app in order to prevent this app from talking to internet. I don't want to block my own access to internet though.
    – sixtytrees
    Mar 25 at 22:26
















  • is user using ni in no-internet group ?
    – Archemar
    Mar 25 at 13:47










  • I am a user (admin with root rights). I want to run ni untrusted-app in order to prevent this app from talking to internet. I don't want to block my own access to internet though.
    – sixtytrees
    Mar 25 at 22:26















is user using ni in no-internet group ?
– Archemar
Mar 25 at 13:47




is user using ni in no-internet group ?
– Archemar
Mar 25 at 13:47












I am a user (admin with root rights). I want to run ni untrusted-app in order to prevent this app from talking to internet. I don't want to block my own access to internet though.
– sixtytrees
Mar 25 at 22:26




I am a user (admin with root rights). I want to run ni untrusted-app in order to prevent this app from talking to internet. I don't want to block my own access to internet though.
– sixtytrees
Mar 25 at 22:26










1 Answer
1






active

oldest

votes

















up vote
0
down vote













user running sg command must be the group being sued uppon.



here I belong to www-data group



archemar@unix:~$ id
uid=1003(archemar) gid=1002(stackexchange) groups=1002(stackexchange),27(sudo),33(www-data)


sg goes OK



archemar@unix:~$ sg www-data id
uid=1003(archemar) gid=33(www-data) groups=33(www-data),27(sudo),1002(stackexchange)


my gid is www-data



Now, I don't belong to ntp group



archemar@unix:~$ sg ntp id
Password:
sg: failed to crypt password with previous salt: Invalid argument





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433360%2fexecute-command-as-a-restricted-group-without-entering-password%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    user running sg command must be the group being sued uppon.



    here I belong to www-data group



    archemar@unix:~$ id
    uid=1003(archemar) gid=1002(stackexchange) groups=1002(stackexchange),27(sudo),33(www-data)


    sg goes OK



    archemar@unix:~$ sg www-data id
    uid=1003(archemar) gid=33(www-data) groups=33(www-data),27(sudo),1002(stackexchange)


    my gid is www-data



    Now, I don't belong to ntp group



    archemar@unix:~$ sg ntp id
    Password:
    sg: failed to crypt password with previous salt: Invalid argument





    share|improve this answer
























      up vote
      0
      down vote













      user running sg command must be the group being sued uppon.



      here I belong to www-data group



      archemar@unix:~$ id
      uid=1003(archemar) gid=1002(stackexchange) groups=1002(stackexchange),27(sudo),33(www-data)


      sg goes OK



      archemar@unix:~$ sg www-data id
      uid=1003(archemar) gid=33(www-data) groups=33(www-data),27(sudo),1002(stackexchange)


      my gid is www-data



      Now, I don't belong to ntp group



      archemar@unix:~$ sg ntp id
      Password:
      sg: failed to crypt password with previous salt: Invalid argument





      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        user running sg command must be the group being sued uppon.



        here I belong to www-data group



        archemar@unix:~$ id
        uid=1003(archemar) gid=1002(stackexchange) groups=1002(stackexchange),27(sudo),33(www-data)


        sg goes OK



        archemar@unix:~$ sg www-data id
        uid=1003(archemar) gid=33(www-data) groups=33(www-data),27(sudo),1002(stackexchange)


        my gid is www-data



        Now, I don't belong to ntp group



        archemar@unix:~$ sg ntp id
        Password:
        sg: failed to crypt password with previous salt: Invalid argument





        share|improve this answer












        user running sg command must be the group being sued uppon.



        here I belong to www-data group



        archemar@unix:~$ id
        uid=1003(archemar) gid=1002(stackexchange) groups=1002(stackexchange),27(sudo),33(www-data)


        sg goes OK



        archemar@unix:~$ sg www-data id
        uid=1003(archemar) gid=33(www-data) groups=33(www-data),27(sudo),1002(stackexchange)


        my gid is www-data



        Now, I don't belong to ntp group



        archemar@unix:~$ sg ntp id
        Password:
        sg: failed to crypt password with previous salt: Invalid argument






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 26 at 7:37









        Archemar

        18.9k93366




        18.9k93366






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433360%2fexecute-command-as-a-restricted-group-without-entering-password%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)