요청이 들어오면 지정된 명령을 실행시키는 데몬?

sunnyncom의 이미지

makefile 구성 중에 문의 사항이 있습니다.

makefile을 돌릴 때 특정 명령이 꼭 root권한 이어야 하는 명령이 있습니다.
여러사람이 돌리는 makefile이라 고민 끝에 root 실행 권한을 갖고 요청된 작업을 대신 실행해주는 프로그램을 만들어야 겠다고 생각했습니다.

즉, root권한을 갖고 있는 데몬이 대기하고 있다가 각 개발자가 make를 실행하면 makefile에 등록된 client 프로그램이 작업을 요청하고
daemon은 작업 요청이 들어오면 특정 작업을 실행합니다.

이런 작업을 하는 데몬을 만들려고 생각하니 생각보다 간단치 않은 일일거 같은데 기존에 존재하는 데몬 중에 응용할 만한 데몬이 있는지요?
root권한이 필요한 작업을 할 수 있어야 합니다...

답변 부탁 드립니다.

익명 사용자의 이미지

daemon을 만들지 않고
sudo 를 사용하거나
특정 명령의 owner와 group을 조정하는 것은 어떻습니까?

daemon 만드는 것은 유닉스 프로그래밍 또는 리눅스 프로그래밍, 네트워크 프로그래밍에 나오는데,
책에 나오는 기본 예제만으로 원하시는 데몬을 만들 수 있겠습니다.

익명 사용자의 이미지

위 글쓴이입니다. SUID에 대하여 알아보세요.

http://curfox.tistory.com/10

굳이 데몬을 만들지 않아도 원하는 작업이 가능할 것 같은데.

chmod 명령을 보면,
http://linux.die.net/man/1/chmod

The letters rwxXst select file mode bits for the affected users: read (r), write (w), execute (or search for directories) (x), execute/search only if the file is a directory or already has execute permission for some user (X), set user or group ID on execution (s), restricted deletion flag or sticky bit (t). Instead of one or more of these letters, you can specify exactly one of the letters ugo: the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the file's group (g), and the permissions granted to users that are in neither of the two preceding categories (o).

이런게 있습니다.

익명 사용자의 이미지

즉,
특정 명령을 /usr/sbin/specific_command 라고 할 때,

owner는 root,
suid를 설정하고,
user group을 makefile_usergroup 로 하고,
user group에 사용자들을 넣으면 원하시는 작업을 할 수 있습니다.

데몬을 만들 필요가 없는거죠.
chmod 명령과 adduser addgroup 이런 류의 명령들이 있을 겁니다.
그 명령으로

ls -l /usr/sbin/specific_command 했을 때,

-rwsr-xr-x 1 root makefile_usergroup 1076680 Apr 23 21:25 /usr/sbin/specific_command

이런 식으로 나와야 하고,
makefile_usergroup 에 (/usr/sbin/specific_command 를 사용할) 사용자들을 넣어주면 됩니다.

참 쉽죠 잉?

sunnyncom의 이미지

체크하는 거 같은데요... 가능한가요?

그리고, 데몬 만드는 것을 여쭤본 건 아니구요... 제가 설명드린 작업을 할 수 있게 해주는 그런 류의 이미 만들어진 데몬은 없나 해서 여쭤 본 겁니다....

답변 감사합니다...

김정균의 이미지

sudo로 특정 명령만 root 권한을 줄 수 있습니다. sudo에 대해서 알아보시는 것이..

%makefiles ALL=(ALL) NOPASSWD: /home/project/make

이렇게 설정을 하면, makefiles 그룹에 포함된 유저들은 /home/project/make 를 다음과 같이 root 권한으로 실행할 수 있습니다.

sudo /home/project/make

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.