특정 그룹으로 프로세스를 실행하는 방법은 무엇입니까? | grep qbittorrent morfik morfik

본인의 사용자 권한으로 응용 프로그램을 시작해야하지만 그룹이 달라야합니다. 따라서 대신 :

$ ps -eo "user,group,args" | grep qbittorrent
morfik   morfik      /usr/bin/qbittorrent

예를 들어 :

$ ps -eo "user,group,args" | grep qbittorrent
morfik   p2p      /usr/bin/qbittorrent

또한 비밀번호를 묻지 않고 수행해야합니다. 이것을 달성 할 수있는 방법이 있습니까?



답변

사용하십시오 sg.

예를 들어 다음 명령은 sleep그룹 을 호출 합니다.group-name

sg group-name -c 'sleep 100'

매뉴얼 페이지에서 :

NAME
   sg - execute command as different group ID

SYNOPSIS
   sg [-] [group [-c ] command]

DESCRIPTION
   The sg command works similar to newgrp but accepts a command. The
   command will be executed with the /bin/sh shell...


답변

sg 그룹 비밀번호 요청

sudo에는 사용자 비밀번호로 동일한 -g 옵션이 있습니다.

sudoers에서 언급 그룹이 필요합니다

나는 / etc / sudoers를 다음과 같이 변경했다.

%wheel All=(ALL) ALL

%wheel All=(ALL:ALL) ALL

때로는 더 편리합니다

sudoers를 편집하는 안전한 방법은 다음과 같습니다.

sudo sudoedit /etc/sudoers


답변

sg와의 비밀번호 프롬프트를 피하려면 그룹의 구성원으로 자신을 추가하십시오.

    sudo gpasswd -M morfik p2p

비밀번호를 제거하고 회원에게만 액세스를 제한해야 할 수도 있습니다

    sudo gpasswd -r p2p
    sudo gpasswd -R p2p

남자 gpasswd
는 당신에게 자세한 내용을 제공합니다


답변