우분투에서 chown 명령어로 권한 주기

2009/03/31 10:32

얼마 전, Download 파티션을 ext3로 새로 포맷했습니다. vfat로 해서 써왔더니 다운로드 받은 파일의 이름이 종종 깨질 때가 있어서 말이죠.

그런데 문제가 생겼습니다. 이전에 했던 방법대로 fstab 파일을 편집했지요. 다만, 마운트는 되어도 제게 권한이 없는게 않겠습니까? 권한이 모조리 root로 가 있어서 읽기도 쓰기도 되지 않아 Download 용으로 사용하려는 제 발목을 붙잡는 겁니다. 이를 두고 이번에도 몇 일동안 컴퓨터와 실랑이를 했습니다.

다행히 오늘 강분도 님이 방법을 알려주셨네요. 리눅스에는 chown 이라는 명령어가 있습니다. 아래는 이 명령어에 대한 man 내용입니다.

NAME
       chown - change file owner and group

SYNOPSIS
       chown [OPTION]... [OWNER][:[GROUP]] FILE...
       chown [OPTION]... --reference=RFILE FILE...

DESCRIPTION
       This manual page documents the GNU version of chown.  chown changes the
       user and/or group ownership of each given file.  If only  an  owner  (a
       user  name or numeric user ID) is given, that user is made the owner of
       each given file, and the files' group is not changed.  If the owner  is
       followed  by  a  colon  and a group name (or numeric group ID), with no
       spaces between them, the group ownership of the  files  is  changed  as
       well.  If a colon but no group name follows the user name, that user is
       made the owner of the files and the group of the files  is  changed  to
       that  user's  login  group.   If the colon and group are given, but the
       owner is omitted, only the group of the files is changed; in this case,
       chown  performs  the same function as chgrp.  If only a colon is given,
       or if the entire operand is empty, neither the owner nor the  group  is
       changed.

...

EXAMPLES
       chown root /u
              Change the owner of /u to "root".

       chown root:staff /u
              Likewise, but also change its group to "staff".

       chown -hR root /u
              Change the owner of /u and subfiles to "root".

옵션을 비롯한 자세한 내용은 man page를 확인하시구요. 간단히 말해서 파일이나 폴더의 권한을 바꾸는 명령어입니다.

전 chown 명령어를 다음과 같이 줬습니다.

sudo chown -hR 유저명 /media/Download

sudo로 root 권한을 얻은 다음에 /media/Download 폴더와 파일들의 권한을 제게 준다는 뜻입니다. 이렇게 하니 간단하게 읽기와 쓰기를 할 수 있게 되었습니다. 역시 아는 게 힘입니다. ^^;

덧붙임

우분투에서 자동으로 파티션을 불러오자. :: http://hisjournal.net/blog/110
CHOWN :: http://www.linuxmanpages.com/man1/chown.1.php
크리에이티브 커먼즈 라이센스
Creative Commons License

6l4ck3y3 0x08 과거의 글모음/내 머리 속의 노트 , , , , , ,

Trackback Address:http://hisjournal.net/blog/trackback/209