Skip to content
The Chat Archive
gpt-3.5-turbo-0301· OpenAI WildChat-4.8M (AI2)

в чем разница? async function createDeleteGroup(agent: AgentList): Promise<string> {…

  1. User

    в чем разница? async function createDeleteGroup(agent: AgentList): Promise { const group = genereteString(); const cmdCreate = sudo groupadd ${group}; const cmdDelete = sudo groupdel ${group};

    await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdCreate); await OperationRepeater.RepeatUntil( async () => (await sshService.execCommandKey(agent.ip, Project.Rpoint, 'getent group')).stdout.includes(group) === true, 10, 1, ); await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdDelete);

    return group; }

    и async function createDeleteGroup(agent: AgentList): Promise { const group = genereteString(); const cmdCreate = sudo groupadd ${group}; const cmdDelete = sudo groupdel ${group};

    await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdCreate); await OperationRepeater.RepeatUntil( async () => (await sshService.execCommandKey(agent.ip, Project.Rpoint, 'getent group')).stdout.includes(group) === true, 10, 1, ); await sshService.execCommandKey(agent.ip, Project.Rpoint, sudo usermod -a -G ${group} ${Project.Rpoint}); await sshService.execCommandKey(agent.ip, Project.Rpoint, sudo gpasswd -d ${Project.Rpoint} ${group});

    await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdDelete);

    return group; }

    что означает await sshService.execCommandKey(agent.ip, Project.Rpoint, sudo usermod -a -G ${group} ${Project.Rpoint}); await sshService.execCommandKey(agent.ip, Project.Rpoint, sudo gpasswd -d ${Project.Rpoint} ${group});

  2. Assistant

    Эти две строчки добавляют и удаляют пользователя Project.Rpoint из группы ${group} соответственно.

    sudo usermod -a -G добавляет пользователя в группу, -a указывает на добавление, -G указывает на группу, к которой нужно добавить пользователя.

    sudo gpasswd -d удаляет пользователя из группы, -d указывает на удаление, а Project.Rpoint и ${group} указывают на пользователя и группу, из которой нужно удалить пользователя.