Linux/Ubuntu2010. 4. 3. 21:31
우분투에서 아파치를 설치하면 아래와 같은 기본설정 파일이 생성된다.
htdocs는 /var/www 이고 root:root 권한을 가진다.
drwxr-xr-x  7 root root  4096 2010-04-03 21:18 www

하지만 apache2는 www-data:www-data 권한으로 서버가 실행되고
웹서버는 /var/www에 대하여 other 권한으로 파일을 access 하게된다.
/var/www를 www-data:www-data 로 변경하는게 무난한 방법이 될 듯하다.

# cat /etc/apache2/apache2.conf
144 # These need to be set in /etc/apache2/envvars
145 User ${APACHE_RUN_USER}
146 Group ${APACHE_RUN_GROUP}

# cat /etc/apache2/envvars
  1 # envvars - default environment variables for apache2ctl
  2
  3 # Since there is no sane way to get the parsed apache2 config in scripts, some
  4 # settings are defined via environment variables and then used in apache2ctl,
  5 # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
  6 export APACHE_RUN_USER=www-data
  7 export APACHE_RUN_GROUP=www-data

'Linux > Ubuntu' 카테고리의 다른 글

Ubuntu 10.04 LTS!  (0) 2010.05.07
udevinfo -> udevadm  (0) 2010.05.03
우분투에 Apache / PHP / Mysql 설치하기  (0) 2010.04.02
fprintf man page가 왜 없지?!  (0) 2010.03.26
apt 명령어 정ㅋ벅ㅋ  (0) 2010.03.04
Posted by 구차니
Linux/Ubuntu2010. 4. 2. 23:16
설치 패키지
apache2
mysql-client-5.1
php5

위에 세가지를 선택하면 아래와 같이 줄줄이 엮여서 설치된다.



아파치 설정
/etc/apache2/apache2.conf (환경설정파일 경로)
/var/www (기본 설치시 htdocs 경로)

Mysql
기본암호는 설치시에 물어봄
/etc/mysql/my.cnf (환경설정파일 경로)
/var/lib/mysql (데이터경로)

PHP
$ cat index.php
<?
    phpinfo();
?>

[링크 : http://coffeenix.net/board_view.php?bd_code=1684]
[링크 : http://www.yamuzin.com/zbxe/758]
[링크 : http://www.sitepoint.com/forums/showthread.php?t=658149]
[링크 : https://help.ubuntu.com/community/ApacheMySQLPHP]

'Linux > Ubuntu' 카테고리의 다른 글

udevinfo -> udevadm  (0) 2010.05.03
apache2 환경설정  (0) 2010.04.03
fprintf man page가 왜 없지?!  (0) 2010.03.26
apt 명령어 정ㅋ벅ㅋ  (0) 2010.03.04
우분투에서 /etc/sysconfig/network 에 대응하는 파일  (0) 2010.02.16
Posted by 구차니
Linux2010. 4. 2. 16:18
console로 열린 터미널에서 일부의 속성만을 변경해서 사용중이었는데
다른건 전송이 되는데 0x11 데이터가 제대로 받아지지 않는 문제가 발생했다.

일단 엔터 치기 전에는 입력이 받아지지 않는건
'캐노니컬 모드(canonical mode)'로 인한 것이기 때문에 ~ICANON 으로 해결을 했지만

0x11 은 DC1(Data Control 1 - XON) 으로 캐노니컬과는 별개이기 때문에 0x11 데이터가 손실되었다.
터미널은 워낙 내용이 방대해서.. 간단하게 해결책만 제시하자면

ffmpeg의 소스중 일부를 인용
 712                 new_set.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
 713                                       |INLCR|IGNCR|ICRNL|IXON);
 714                 new_set.c_oflag |= OPOST;
 715                 new_set.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
 716                 new_set.c_cflag &= ~(CSIZE|PARENB);
 717                 new_set.c_cflag |= CS8;
 718                 new_set.c_cc[VMIN] = 1;
 719                 new_set.c_cc[VTIME] = 0;


       IXON   Enable XON/XOFF flow control on output.
       IXOFF  Enable XON/XOFF flow control on input.

[링크 : http://linux.die.net/man/3/tcgetattr]

결론 : 아마도 이랬을 것입니다
Posted by 구차니
Linux2010. 4. 1. 14:12
ls 자체적으로 정렬기능을 제공한다.
하지만, 디렉토리별이라서, 전체에 대해서 정렬을 하지는 못한다.

       -S     sort by file size

       --sort=WORD
              extension -X, none -U, size -S, time -t, version -v, status -c, time -t, atime -u, access -u, use -u

[링크 : http://linux.die.net/man/1/ls]

[링크 : http://thedaneshproject.com/posts/sort-files-by-size/]
Posted by 구차니
Linux2010. 3. 31. 11:38
fileno() 는 fp를 fd로 변환해주고
fdopen()은 fd를 fp로 변환해준다.

int fileno(FILE *stream);
FILE *fdopen(int fildes, const char *mode);

[링크 : http://linux.die.net/man/3/fileno]
[링크 : http://linux.die.net/man/3/fdopen]

아무튼 원하는 파일이나, stdin/out/err에 대한 fd를 얻어온뒤
fcntl() 함수를 이용하여 변경하면 된다.

fctnl(fd, F_SETFL, O_NONBLOCK);
(테스트 안해봣음!)

int fcntl(int fd, int cmd, long arg);

F_SETFL
    Set the file status flags to the value specified by arg. File access mode (O_RDONLY, O_WRONLY, O_RDWR) and file creation flags (i.e., O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC) in arg are ignored. On Linux this command can only change the O_APPEND, O_ASYNC, O_DIRECT, O_NOATIME, and O_NONBLOCK flags.

[링크 : http://linux.die.net/man/2/fcntl]
[링 크 : http://www.falinux.com/win/study/06/devicedriver11.html]

Posted by 구차니
Linux/Ubuntu2010. 3. 26. 22:02
build-essencial을 깔았다고 해서 각종 man page들이 설치되는 것은 아니다.
각종 개발관련 man page는 manpages-dev 패키지에 존재한다.

$ sudo apt-get install manpages-dev

[링크 : https://lists.ubuntu.com/archives/ubuntu-users/2009-May/182747.html]
Posted by 구차니
Linux2010. 3. 26. 17:12
putty로 두개의 창을 ssh를 통해 열었는데,
ps -ef | grep sshd로 하니 아래와 같이 4개의 ssh 데몬이 검색되었다.
root      2050     1  0 Mar24 ?        00:00:00 /usr/sbin/sshd
root     25402  2050  0 10:23 ?        00:00:00 sshd: morpheuz [priv]

morpheuz 25404 25402  0 10:23 ?        00:00:00 sshd: morpheuz@pts/1
root     26343  2050  0 16:53 ?        00:00:00 sshd: morpheuz [priv]
morpheuz 26345 26343  0 16:53 ?        00:00:00 sshd: morpheuz@pts/4
morpheuz 26394 25405  0 17:00 pts/1    00:00:00 grep --color=auto sshd

priv는 previleged의 약자로, 보안을 강화하기 위해
접속은 소켓을 열수 있는 root로 열고
root의 sshd가 chile process를 만들어, 권한을 제한하여 서비스를 해준다.

위의 ps -ef 에서 보이듯,
[root] /usr/sbin/sshd
[root]           + sshd : morpheuz [priv]
[user]                    + sshd : morpheuz@pts/1
[root]           + sshd : morpheuz [priv]
[user]                    + sshd : morpheuz@pts/4
계층구조로 실행되며, 실질적인 권한은 사용자 권한으로 한정시켜, 시스템에 손상을 입히는 행위를 예방한다.

LOGIN PROCESS
     When a user successfully logs in, sshd does the following:

           1.   If the login is on a tty, and no command has been specified, prints last
                login time and /etc/motd (unless prevented in the configuration file or by
                ~/.hushlogin; see the FILES section).
           2.   If the login is on a tty, records login time.
           3.   Checks /etc/nologin; if it exists, prints contents and quits (unless root).
           4.   Changes to run with normal user privileges.
           5.   Sets up basic environment.
           6.   Reads the file ~/.ssh/environment, if it exists, and users are allowed to
                change their environment.  See the PermitUserEnvironment option in
                sshd_config(5).
           7.   Changes to user’s home directory.
           8.   If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists, runs it; other-
                wise runs xauth.  The “rc” files are given the X11 authentication protocol
                and cookie in standard input.
           9.   Runs user’s shell or command.

[링크 : http://linux.die.net/man/8/sshd]

[링크 : http://www.citi.umich.edu/u/provos/ssh/privsep.html]
[링크 : http://www.citi.umich.edu/u/provos/ssh/privsep-faq.html]



Posted by 구차니
Linux2010. 3. 25. 17:10
fdisk는 몇가지 옵션을 제공하지만, 실질적으로
interactive mode로 일일이 하나씩 설정을 해야 한다.

즉, 프로그램에 내장시켜 파티션을 전부 삭제하고,
단일 파티션으로 잡는다거나 하는 용도로 쓰기에는 모호한 감이 있다.

이를 해결하기 위해서 fdisk를 대화식으로 하지 않는 방법을 찾거나
$ echo -e "n\np\n1\n\n\nt\n8e\nw" | fdisk /dev/sdX

[링크 : http://www.commandlinefu.com/commands/using/fdisk]

혹은 다른 프로그램을 사용해야 한다.

[링크 : http://linux.die.net/man/8/sfdisk]
    [링크 : ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/]
[링크 : http://linux.die.net/man/8/parted]
    [링크 : http://www.gnu.org/software/parted/index.shtml]

Sfdisk is part of the util-linux package, which, as far as I can tell,
is unmaintained since the last release in Sept 2005.

There is a fork called util-linux-ng, released August 2007,
which you can get here: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/

[링크 : http://www.linuxquestions.org/questions/linux-software-2/location-of-the-latest-sfdisk-source-590331/]

Posted by 구차니
Linux/Fedora Core2010. 3. 24. 15:34
sudo는 일시적으로 권한을 상승시켜 특정 프로그램을 실행하는 명령어이다.
그런데, FC6에서는 기본적으로 sudo를 사용하지 않고 있어서 추가를 해주어야 한다.


/etc/sudoers 는 설정파일로
## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##      user    MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
이 부분만 추가되어있다.
이 줄을 복사해서 root 대신 사용자 아이디를 넣어주면, 그 사용자는 모든 명령어에 대해 sudo로 실행할수 있게 된다.

예를 들어 dev라는 사용자를 추가하려면
dev    ALL=(ALL)       ALL
를 추가해주면 된다.


하지만, 이렇게만 하면 아래와 같은 문구가 나타난다.(lecture)
$ sudo ls

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Password:

이녀석을 매번 보기 싫다면
Defaults    lecture = never
이 녀석을 한줄 추가해주면

ubuntu 처럼 깔끔하게
$ sudo ls
Password:
요렇게만 물어본다.

원래대로라면 직접 /etc/sudoers를 vi로 수정하지 말고
visudo 라는 vi를 이용하여 안전하게 수정을 해야 하지만, FC6에서는 없는듯 하다.

       lecture     This option controls when a short lecture will be printed along with the password prompt.
                   It has the following possible values:

                   never   Never lecture the user.
                   once    Only lecture the user the first time they run sudo.
                   always  Always lecture the user.

                   If no value is specified, a value of once is implied.  Negating the option results in a value of
                   never being used.  The default value is once.

       lecture_file
                   Path to a file containing an alternate sudo lecture that will be used in place of the standard lec-
                   ture if the named file exists.

[링크 : http://linux.die.net/man/5/sudoers]

[링크 : http://www.mjmwired.net/resources/mjm-fedora-fc6.html]
[링크 : http://ubuntuforums.org/archive/index.php/t-483591.html]
Posted by 구차니
Linux2010. 3. 19. 10:44
엄밀하게, DOS 처럼 quick format은 존재하지 않는다.
mkfs.ext3 에서 -c 옵션으로 bad sector를 확인하는게 normal format이고
아무런 옵션없이 포맷하는게 quick format인 셈이다.


결론 : 그냥 옵션없이 하는게 quick 인데 느리군요(500GB 하는데 한 1분 걸린듯?)

[링크 : http://kldp.org/node/73233]
[링크 : http://linux.die.net/man/8/mkfs.ext3]
Posted by 구차니