linux 권한 질문입니다 도와주세요 고수님들

dhrhd080의 이미지

실행환경은 ubuntu 16.04 linux 이구요

$$chown root:root 특정파일$$ 를 써서 특정파일의 소유주 권한을 root 즉 최상위관리자로 만들고

$$ls -al 특정파일$$ 을 하면 $$-rwxr -xr -x$$ 이렇게 나오는데 그러면 이 특정파일에서

root 경로에 있는 다른 파일을 읽고 쓰고 실행할수 있는거 아닌가요?

이게 안되서 찾아보니깐 SETUID 설정을 해야한다고 해서 $$chmod 4755$$ 하니깐 이제서야 되더라구요

익명 사용자의 이미지

바로 그런 형태의 동작을 위해서 setuid가 있는 것입니다.

반대로 말하면, setuid를 걸지 않으면 원래 그렇게 동작하지 않지요.

특정 파일의 소유주가 root인 것과, 그 파일을 실행하면 root의 권한으로 실행되는 것은 다른 겁니다.

전자이면서 후자가 아닌 예시로 귀하께서 사용한 ls 프로그램이 있지요.

dhrhd080의 이미지

파일의 소유주와 권한을 헷갈린것 같네요 그런데 또 헷갈리는게 특정파일의 소유주가 일반사용자인 상태에서 SETUID를 하고 이 특정파일에서 root에 있는 다른 파일을 fopen하면 안되더라구요 꼭 소유주를 root로 바꿔주고
SETUID까지 해야지 되는데 왜 이런지 잘 모르겠네요 ㅠ

익명 사용자의 이미지

왜냐하면 setuid는 "해당 파일이 소유주의 권한으로 실행될 것"을 나타내기 때문이지요.
대개 그 소유주는 루트인 경우가 많지만, 원한다면 다른 계정도 얼마든지 가능합니다.

setuid의 동작에 대해서는 검색해보면 수도 없이 많은 자료들이 있습니다.
https://idchowto.com/?p=42667 등등.

김정균의 이미지

ls 결과가

$$ls -al 특정파일$$ 을 하면 $$-rxsr -xr -x$$

라고 했는데, 이 상태가 맞다면 이미 SUID 는 걸려 있는 것 같은데요.

dhrhd080의 이미지

실수로 나중결과를 올렸네요

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.