crontab -e 등으로 설정변경시 일반적으로는 시스템에 기본 설정된 에디터인 vi가 실행됩니다.
이때 사용되는 에디터를 각자 입맛(?)에 맞는 에디터(pico, joe 등)로 변경하려면 다음과 같이 합니다.

#export EDITOR=/usr/bin/jpico
위 명령을 쉘상에서 실행하거나 홈디렉토리의 .bash_profile 에 설정하면
이후로는 기본에디터가 해당 경로상에 있는 것으로 변경됩니다.
2005/07/05 15:23 2005/07/05 15:23

vsftp 설정파일 정리.

FAQ 2005/07/05 15:22
# anonymous 사용자의 접속 허용 여부 (default = YES)
# 공개된 형태의 FTP 서버로 운영할 것이 아니라면 NO로 한다.
anonymous_enable=NO
# 로컬 계정 사용자의 접속 허용 여부 (default = NO)
local_enable=YES

# write 명령어 허용 여부 (defualt = NO)
write_enable=YES
# 로컬 계정 사용자용 umask (default = 077)
local_umask=022

# anonymous 사용자가 파일을 업로드 할 수 있는지 여부 (default = NO)
# anon_upload_enable=YES
# anonymous 사용자의 디렉토리 생성 허용 여부 (default = NO)
# anon_mkdir_write_enable=YES

# 파일 전송 로그를 남길 것인지 여부 (default = YES)
xferlog_enable=YES
# xferlog 표준 포맷으로 로그를 남길지 여부 (기본 설정파일은 YES)
# 아래에서 NO로 설정했을 때를 설명함
xferlog_std_format=YES
# 파일 전송 로그 파일명
xferlog_file=/var/log/vsftpd.log

# FTP 서버 접속할 때 로긴 메시지 (default = vsFTPd 버전번호)
# 한글 사용 가능
# ftpd_banner=Welcome to blah FTP service.

# 사용자의 홈디렉토리를 벗어나지 못하도록 제한하기 위한 설정 (default=NO)
# 제한이 필요할 경우 YES로 바꾼 후 제한할 사용자 ID를 chroot_list_file= 에 설정한 파일에
# 지정한다.
# chroot_local_user= 설정과 관련이 있으니 '3. 문제 해결'을 꼭 읽어보라.
#
# chroot_list_enable=YES
# chroot_list_file=/etc/vsftpd.chroot_list

# -------------------------------------------------------------------
# 기본 설정 파일에는 없는 설정값으로 필요한 설정만 추가한다.
# ※ 중요한 설정은 굵은 글씨로 표시
# -------------------------------------------------------------------

# PAM 파일명을 지정 (설치할 때 /etc/pam.d/vsftpd명으로 복사함)
pam_service_name=vsftpd

# wtmp에 로그 남기기 (YES로 해야만 last 명령어로 접속 여부 확인 가능)
session_support=YES

# 사용자가 자신의 home directory를 벗어나지 못하도록 설정
chroot_local_user=YES

# 새로운 디렉토리에 들어갔을 때 뿌려줄 환경 메시지를 저장한 파일명
# message_file=.message

# xferlog 형식으로 log를 남기려면 (위에서 이미 YES로 했음)
# xferlog_std_format=NO
#
#  - xferlog 표준 포맷은 로긴, 디렉토리 생성등의 로그를 남기지 않음
#   그러나 vsftpd 스타일 로그는 이를 포함한 보다 상세한 로그를 남김
#  - vsftpd 스타일 로그 예
#
#  Sun Jul 12 01:38:32 2003 [pid 31200] CONNECT: Client "127.0.0.1"
#  Sun Jul 12 01:38:34 2003 [pid 31199] [truefeel] FAIL LOGIN: Client "127.0.0.1"
#  Sun Jul 12 01:38:38 2003 [pid 31199] [truefeel] OK LOGIN: Client "127.0.0.1"
#  Sun Jul 12 01:38:41 2003 [pid 31201] [truefeel] OK MKDIR: Client "127.0.0.1", "/mp3"
#  Sun Jul 12 01:39:06 2003 [pid 31201] [truefeel] OK UPLOAD: Client "127.0.0.1", "/델리
#  스파이스 5집 - [04]키치죠지의 검은 고양이.mp3", 6855473 bytes, 3857.39Kbyte/sec

# 전송속도 제한 (0은 제한없음, 단위는 초당 bytes)
anon_max_rate=0
local_max_rate=0
trans_chunk_size=0

# 최대 접속 설정 (단 xinetd를 통하지 않고 standalone으로 동작할 때만 사용 가능)
# standalone을 위해서는 listen=YES 추가하고 별도로 vsftpd를 띄워야 함
#
# max_clients=최대 접속자 수, max_per_ip=IP당 접속 수
# max_clients=100
# max_per_ip=3

# Standalone 으로 운영할 때 listen=YES. 포트 변경을 원할 경우 listen_port 설정
# 디폴트 포트는 21번 포트이다.
# listen=YES
# listen_port=21
-------------------------------------------------------------
2005/07/05 15:22 2005/07/05 15:22
기본적으로 알 수 없습니다.
유닉스에서는 파일의 생성 날짜는 어디에도 저장되어 있지 않습니다.
파일은 최근 수정시간 (ls -l에 의해 보여지는)과 최근 접근시간(ls -lu)
에 의해 보여지는) 그리고 inode변경시간(ls -lc)가 있습니다.
마지막 것이 자주 어떤 매뉴얼 페이지에서는 "생성 시간"으로 언급 되기도
하지만 그것은 틀린 것입니다. 그것은 또한 mv나 ln chmod, chown, chgrp에
의해 변경되기 때문 입니다.
2005/07/05 15:22 2005/07/05 15:22
심볼릭 링크의 퍼미션은 실제로 아무런 의미가 없습니다.
가치있는 유일한 퍼미션은 링크가 가르키고 있는 파일의
퍼미션 입니다. 심볼릭 링크의 퍼미션을 변경 한다고 해도
실제 링크되어 있는 파일에는 영향을 주지 않습니다.
2005/07/05 15:21 2005/07/05 15:21
Solaris 2.x에서는 초기에는 따로 파티션을 잡아서 swap영역을 사용하지만
나중에 추가할 경우 swap파일을 만들어서 추가합니다. 이때 사용하는
명령어가 mkfile 입니다. 만일 /opt/swap이라는 200MB짜리의 파일을
만들어서 swap영역으로 쓰고 싶다면 아래와 같이 파일을 만들고
swap명령어로 추가할 수 있습니다.

% mkfile 200m /opt/swap
% swap -a /opt/swap

만일 항상 사용할 swap영역이라면 /etc/vfstab에 추가하면 됩니다. 다음은
/opt/swap을 추가한 /etc/vfstab의 예제입니다.

% cat /etc/vfstab
.
.
swap - /tmp tmpfs - yes -
/opt/swap - - swap - no -
%
2005/07/05 15:20 2005/07/05 15:20
ftp 접속시 connect 되는 시간이 늦어질때 /etc/proftpd.conf 파일의

13 번째 항목 부분을 아래와 같이 수정하면 바로 접속 되는것을

볼수 있을것이다.

# See - http://www.proftpd.org/docs/faq/linked/faq-ch4.html#AEN341

#

#13. Slow logins

#

#This is probably caused by a firewall or DNS timeout. By default ProFTPD will try to do both DNS and ident lookups against the incoming connection. If these are blocked or excessively delayed a slower than normal login will result. To turn off DNS and ident use:

#

UseReverseDNS off

IdentLookups off


위 ldentLookups를 off 로 해두면 접속시간이 빨라 진다.
2005/07/05 15:19 2005/07/05 15:19
일반적으로 grep 으로 해당 디렉터리에 위치한 파일들이 포함하고 있는 특정 문자열을 찾지만, 하위 디렉터리까지 찾을 때에는 다음과 같은 방법들을 많이 사용합니다.
cat * | grep 문자열 `ls`
find ./ -name '*' | xargs grep -ne '문자열'
find . -exec grep '문자열' {} /dev/null \;
grep -nHr 문자열 *
이 외에도 여러가지가 있지만 더욱 간단한 방법으로 다음의 명령으로 해결 할 수도 있습니다.
grep -R 문자열 *
하지만 간혹 구버전일 경우 -R 옵션이 없는 경우가 있을 수 있으며, 그러한 때에는 다음의 명령을 이용할 수도 있습니다.
grep --recursive "문자열" *
2005/07/05 15:18 2005/07/05 15:18
다운로드 소스
httpd-2.0.52.tar.gz (apache.org)
php-5.0.2.tar.tar (php.net)
libxml2-cvs-snapshot.tar.gz (xmlsoft.org)


#### libxml 설치하기 ####
1.)tar xvzf libxml2-cvs-snapshot.tar.gz
2.)./configure
3.)make
4.)make install

#### 아파치 설치하기 ####
1.) tar xvzf httpd-2.0.52.tar.gz
2.) ./configure --prefix=/usr/local/apache_2.0.52 --enable-rule=SHARED_CORE --enable-modules=so --enable-so
3.) make
4.) make install

#### php 설치 ####
1.) tar xvzf php-5.0.2.tar.tar
2.) ./configure --prefix=/usr/local/php_5.0.2 --with-apxs2=/usr/local/apache_2.0.52/bin/apxs --with-config-file-path=/usr/local/apache_2.0.52/conf --with-mysql=/usr/local/mysql
3.) make
4.) make install

httpd.conf , mysql 설치는 생략했습니다.
그리고 /usr/local/apache_2.0.52/bin/apachecl start 하시면
httpd.conf 파일이 없다고 안되실수도 있는데..이럴땐
ln -s /usr/local/apache_2.0.52/conf/httpd.conf /etc/httpd/conf/httpd.conf
해서 링크시키면 됩니다.
2005/07/05 15:18 2005/07/05 15:18
이 글은 암호없이 scp를 사용하는 방법을 설명한다.

리눅스 시스템 관리자는 자주 컴퓨터간에 파일을 복사하거나 파일을 여러 컴퓨터로 전송한다.
ftp를 사용해도 되지만, scp를 사용하면 많은 이점이 있다.
ftp는 LAN/WAN에 내용(심지어 암호도)을 그대로 전송하지만, scp는 암호화하여 전송하기때문에 ftp보다 안전하다.

scp의 장점은 쉽게 스크립트에서 사용할 수 있는 점이다. 파일을 리눅스 컴퓨터 100대로 복사한다고 가정한다.
직접 100번 복사 명령어를 실행하는 것보다 스크립트를 작성하고 싶을 것이다.
스크립트에서 ftp를 사용하면 로그인할때마다 암호를 물어보기때문에 힘들다
(역주; netrc 파일을 사용하여 암호를 자동으로 입력하게 만들 수 있지만 보안상 위험하다).
대신 scp를 사용하는 경우 원격 리눅스 컴퓨터가 암호를 물어보지 않도록 설정할 수 있다.
믿거나 말거나 이 방법은 ftp보다 훨씬 더 안전하다!

scp의 기본 문법은 다음과 같다.
현재 컴퓨터에 있는 'abc.tgz' 파일을 'bozo'라는 원격컴퓨터의 /tmp 디렉토리로 복사하려면:

scp abc.tgz root@bozo:/tmp

그러나 이 경우 bozo의 root 암호를 물어본다.
암호를 물어본다면 스크립트에서 쉽게 사용할 수 없다.
해결책은 다음과 같다 (한번만 해주면 "암호없이" 무제한 scp로 복사할 수 있다):

1. 나중에 scp를 사용하여 파일을 복사할 사용자를 결정한다.
물론 root가 가장 강력하고, 난 개인적으로 root를 사용한다.
여기서 root를 사용할때 발생할 수 있는 보안상 문제점을 강의할 생각은 없다.
내가 지금 무슨 말을 하는지 모르겠다면 root가 아닌 일반 사용자를 사용하라.
결정했다면 이제 그 사용자로 로그인하여 다음 단계를 진행한다.


2. 컴퓨터에 공개키(public key)와 비밀키(private key)를 만든다.
이게 뭔가? 공개키 암호화 방식을 모른다면 15초간 설명하겠다.
공개키 암호화 방식은 수학적으로 연관된 공개키와 비밀키를 만든다.
그런 다음 공개키는 누구에게라도 줄 수 있지만, 비밀키는 아무에게도 알려주면 안된다.
키들의 수학적 구성상 신기하게도 누구나 공개키를 가지고 내용을 암호화할 수 있지만,
비밀키를 가진 당신만이 암호화한 결과를 해독할 수 있다. 어쨋든 두 키를 만드는 명령은:

ssh-keygen -t rsa


3. 다음과 같이 출력한다:
"Generating public/private rsa key pair"
"Enter file in which to save the key ... "
그냥 enter를 누른다.

4. 그러면 다음과 같이 출력한다:
"Enter passphrase (empty for no passphrase):"
passphrase를 사용하지 않기때문에 enter를 두번 누른다.


5. 그러면 마지막으로:
"Your identification has been saved in ... "
"Your public key has been saved in ... "
방금 만든 공개키 파일명과 위치를 기억하라 (항상 파일명이 .pub로 끝난다).

6. 공개키를 파일을 복사할 모든 원격 리눅스 컴퓨터에 복사한다.
scp나 ftp를 사용하여 복사한다. root를 선택했다면 (다시 단계 1의 경고를 주의하라),
키는 /root/.ssh/authorized_keys (철자 조심!)에 있어야 한다. root가 아니고 예를 들어 clyde로 로그인한다면,
/home/clyde/.ssh/authorized_keys 에 있어야 한다. authorized_keys 파일이 다른 컴퓨터의 키를 저장하고 있을 수 있기때문에,
파일에 이미 내용이 있다면 (새파일을 덮어쓰지않고) 공개키 파일 내용을 뒤에 추가해야 한다.

이제 끝이다. 별다른 문제가 없다면 파일을 암호없이 원격컴퓨터로 scp할 수 있다. 다시 한번 테스트해보자.
컴퓨터에 있는 'xyz.tgz' 파일을 'bozo'라는 원격컴퓨터의 /tmp 디렉토리로 복사한다

scp xyz.tgz root@bozo:/tmp

와 !!! 암호를 물어보지 않고 복사가 된다!!

일단 암호 하나로 컴퓨터에 로그인하면 모든 원격컴퓨터에 접근할 수 있기때문에 보안에 대해서 주의하라.
그래서 암호를 더 잘 보호해야 한다.

이제 즐길 차례다.
컴퓨터에 있는 'houdini'란 파일을 10개 도시에 흩어져있는 원격컴퓨터의 /tmp 디렉토리로 복사하는 짧은 스크립트를 (5분 안에)
작성해보자. 물론 원격컴퓨터가 100대거나 1000대라도 마찬가지다.
원격컴퓨터들의 이름은: brooklyn, oshkosh, paris, bejing, winslow, rio, gnome, miami, minsk, tokyo.
스크립트는 다음과 같다:

#!/bin/sh
for CITY in brooklyn oshkosh paris bejing winslow rio gnome miami minsk tokyo
do
scp houdini root@$CITY:/tmp
echo $CITY " is copied"
done

신기한 마술같다.
스크립트에서 echo 줄은 현재 진행상황을 알려준다.

혹시 쉘스크립트가 생소하다면 좋은 투토리얼이 있다:
http://www.freeos.com/guides/lsst/.

알다시피 scp는 더 강력한 ssh의 일부이다.
위의 6 단계를 마쳤다면 원격컴퓨터에서 명령어를 실행할 수 있다
(물론 암호없이!). 예를 들어, brooklyn 이라는 원격컴퓨터의 시간을 보려면:

ssh brooklyn "date"

이제 두 개념을 합쳐서 진짜로 멋진 스크립트를 만들어보자. 모든 원격 리눅스 컴퓨터를 백업하기란 쉬운 일이 아니다. 아래 스크립트는 각 컴퓨터의 /home 디렉토리를 백업한다. 상용 백업 소프트웨어와 비교하면 기능은 매우 기본적이지만, 가격면에서는 따라올 수 없다. 대부분의 상용 백업 소프트웨어는 백업할 컴퓨터 대수대로 가격을 매긴다. 이런 패키지를 사용한다면 원격컴퓨터 100대에 대한 비용을 지불하는 대신 원격컴퓨터를 한 컴퓨터로 백업하는 스크립트를 사용한라. 그리고 그 컴퓨터에서만 상용 패키지를 사용하면 99대분 가격을 절약할 수 있다 ! 어쨌던 스크립트를 참고하여 자신의 상황에 알맞는 스크립트를 작성할 수 있다. 이 스크립트를 cron 작업에 걸어둔다 (원격컴퓨터에는 필요없다). 주석을 보면 자세한 내용을 알 수 있다:

#!/bin/sh

# 변수는 구별하기위해 대문자로 지었다

# 스크립트를 실행하기 전에 원격컴퓨터마다 '/tmp/backups'라는 디렉토리를
# 만들고, 컴퓨터에는 '/usr/backups'라는 디렉토리를 만들어야 한다


# 컴퓨터에서,
# date 명령어 결과를 보기 좋게 만들어서 "DATE" 변수를 설정한다
#
DATE=$(date +%b%d)

# 'for 반복문'은 세가지 작업을 한다

for CITY in brooklyn oshkosh paris bejing winslow rio gnome miami minsk tokyo
do

# 1) 원격컴퓨터의 하드디스크가 꽉차지 않도록 저번에 실행한 스크립트가 만든 tarball을 삭제하고
# 확인을 위해 echo한다
#
ssh -1 $CITY "rm -f /tmp/backups/*.tgz"
echo $CITY " old tarball removed"

# 2) 원격컴퓨터마다 /home 디렉토리를 tarball로 만들어서 /tmp/backups에 저장한다
# tarball 파일명은 구별하기위해 도시명과 시간으로 짓는다
#
ssh $CITY "tar -zcvpf /tmp/backups/$CITY.$DATE.tgz /home/"
echo $CITY " is tarred"

# 3) 원격컴퓨터에 있는 tarball을 /usr/backups 디렉토리로 복사해온다
#
scp root@$CITY:/tmp/backups/$CITY.$DATE.tgz /usr/backups
echo $CITY " is copied"

done


# 나머지 부분은 오류검사용으로 없어도 된다:

# 파일명에 날짜를 포함한 오류파일을 만든다.
# 백업이 안된 컴퓨터가 있다면 이 파일에 기록한다
#
touch /u01/backup/scp_error_$DATE

for CITY in brooklyn oshkosh paris bejing winslow rio gnome miami minsk tokyo

do

# tarball이 복사되었는지 검사한다. 없다면 오류파일에 기록한다
# '||'은 앞에 있는 부분이 참이 아닐때만 뒤에 있는 부분을 실행한다는 뜻이다
#
ls /u01/backup/$CITY.$DATE.tgz || echo " $CITY did not copy" >> scp_error_$DATE


# tarball을 정상적으로 열 수 있는지 검사한다. 문제가 있다면 오류파일에 기록한다.
tar ztvf /u01/backup/$CITY.$DATE.tgz || echo "tarball of $CITY is No Good" >> scp_error_$DATE

done

출처 : linux gazette
2005/07/05 15:16 2005/07/05 15:16

rsync 사용하기

FAQ 2005/07/05 15:16
rsync란 서로 다른 두 컴퓨터에 들어 있는 정보를 서로 동기화 시킬때 사용한다.
동일한 소스가 두군데 존재하고 한쪽을 편집했을때, 다른 한쪽에 편집한 부분을 업데이트 시켜줘야한다.
이때 모든 소스를 옮기게 되면 시간적으로 많은 낭비가 있기 때문에 rsync는 수정된 부분만 비교해서 옮겨 주게 된다.
그리고 anonymous 서버로도 설정할 수 있는등 많은 유용한 기능들이 들어있다.

rsh이나 ssh을 이용하여 전송하기
이것은 원격지의 호스트에 계정이 있고 rsync의 서버 데몬이 설정되어 있지 않을 경우 사용한다.
간단히 로컬에서도 cp 대신 사용할 수도 있다. ssh를 이용하면 안전하게 복사할 수 있다.
아래의 방법대로 하면 간단히 원격지로 복사할 수 있다.

shell> rsync -arvu -e ssh /from/directory/ to.hostname.com:/to/direcotry

여기서 디렉토리를 써 줄경우 마지막 부분의 /가 중요한 의미를 가진다.
마직막에 /가 있을 경우는 그 디렉토리 내의 모든 파일을 의미하고 /가 없을 경우는 그 디렉토리 자체를 말하는 것이다.
-arvu는 아래 부분을 참조하기 바란다.

원격지 서버 설정하기
먼저 리눅스 최신본을 설치하면 기본적으로 rsync가 설치된다. 그러나 xinetd를 이용하여 서버로 설정은 되어 있지 않기 때문에 서버로 사용할 수 있도록 설정을 해 주어야 한다.

xinetd.d에 rsync파일 추가하기
/etc/xinetd.d디렉토리에 rsync라는 파일을 만들고, 아래와 같은 내용을 입력한뒤, 저장한다.

service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}

/etc/services파일에도 아래와 갈은 내용이 없으면 추가해 주도록 한다.

rsync 873/tcp # rsync
rsync 873/udp # rsync

그리고 /etc/rc.d/init.d/디렉토리에서 xinetd를 restart 시켜준다.

shell> /etc/rc.d/init.d/xinetd restart

rsyncd.conf 파일 생성
/etc디렉토리에 rsync.conf라는 파일을 생성한다.

#motd = /etc/rsync.motd # file : message of the day
uid = nobody
gid = nobody
use chroot = no
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid

[www.wangsy]
path = /somewhere/in/remote/host
comment = www.wangsy.com homepage
read only = false
uid = apache
gid = apache
auth users = wangsy
secrets file = /etc/rsyncd.secrets

위 파일과 함께 /etc디렉토리에 rsyncd.secrets파일도 함께 생성한다.

name:password

그리고 /etc/rsyncd.secrets파일의 permission을 rw-------로 해주는 것을 잊지 말도록 한다.

client에서 접근하기
서버 내용 내려받기
다음 명령을 통해서 서버의 내용을 다운 받을 수 있다.

shell> rsync -avz home.inzoo.co.kr::www.wangsy target_dir/

그리고 아래 명령을 통해서 로컬에서 수정된 파일을 서버에 반영할 수 있다.

shell> rsync -avz target_dir/ home.inzoo.co.kr::www.wangsy

위에서 -avz의 의미는 각각 다음과 같다. 자세한 사항은 rsync 홈페이지의 메뉴얼에서 확인할 수 있다.

-a, --archive archive mode
-v, --verbose increase verbosity
-z, --compress compress file data
-u, --update update only (don't overwrite newer files)

약간의 문제
client의 ip와 hostname이 lookup되지 않으면 remote호스트에서 접근을 허용하지 않는 문제가 있다. 이는 ADSL로 접속할 경우 연결이 되지 않게 되는 문제가 발생한다. 서버로 바로 접속하는 것 보다는 위 처음 방식인 ssh를 통한 접속 방법이 좀더 보안상 안전하기 때문에 이방법을 이용하는것이 좋을듯 하다.

관련 사이트
rsync 공식 홈페이지
linux.co.kr내 테마 리눅스-rsync 강좌
2005/07/05 15:16 2005/07/05 15:16
리눅스에서의 파일 삭제는 신중을 기해야 한다. 왜냐면 삭제된 파일은 복구
할 수 없기 때문이다. 이것이 정석이였습니다.

물론 rm 의 소프트링크나 다른 삭제 프로그램으로 대체하는 프로그램들도 있습
니다만 rm 자체의 복구는 없다고 알고 있으신 분들이 대부분 일 겁니다.

해답은

debugfs 라는 명령어 입니다. (man page 참조)

실제 사용예를 들어 설명하겠습니다.

가정1) /home/pds/portsentry.tar.gz 라는 파일이 있음.
가정2) /home 파티션은 hda8 입니다. (df -h 로 확인)
가정3) rm -f /home/pds/portsentry.tar.gz 명령으로 지웠음.
가정4) root 로 작업.

복구 절차.

1. #debugfs /dev/hda8

=> 설명 : hda8 파티션에 대해서 검사를 한다.

2. debugfs:

=> 대기상태를 뜻함. 이곳에서 lsdel 을 입력하고 엔터.
계속...

debugfs: lsdel
99 deleted inodes found.
Inode Owner Mode Size Blocks Time deleted
108123 0 100644 239 1/ 1 Thu Jan 3 01:25:33 2002
18417 0 100644 426625 420/ 420 Thu Jan 3 01:26:34 2002
45007 0 100644 343 1/ 1 Thu Jan 3 01:29:59 2002
28691 0 100400 879 1/ 1 Thu Jan 3 01:38:29 2002
18394 0 40755 0 1/ 1 Thu Jan 3 01:58:54 2002
..
.
14356 0 100644 2325 3/ 3 Fri Jan 25 16:13:24 2002
61239 0 100644 43034 44/ 44 Fri Jan 25 16:13:31 2002
debugfs:

위와 같은 상태로 나오고 다시 대기상태로 됩니다. 실제로는 너무 많이 나오더
군요.. (내가 그렇게 많이 지웠었나? '.'a)

이제 이 목록중에서 하나를 선택해서 살려야 합니다. 다행히도 살리고자 하는
파일은 가장 최근에 지운 파일이므로 가장 아래쪽에 있는 것이겠죠.

debugfs: dump <61239> /home/debugfs/portsentry.tar.gz

=> Inode 값을 <> 안에 적어줍니다. 뒤에는 복구할 파일 이름을 적어주시면 됩
니다.
=> 복구할 파일은 다른 디렉토리로 지정해 주시는게 좋습니다. 별 상관은 없지
만...

#cd /home/debugfs
#tar -zxvf portsentry.tar.gz // 정상적으로 압축이 풀리더군요.

=> 아주 훌륭하게 복구가 되었더군요. ^^v

임의로 portsentry.tar.gz 를 지워서 테스트를 한 것입니다.

debugfs: 상태에서 사용할 수 있는 명령어는 help 를 쳐보면 알 수 있습니다.
끝내는 것은 q, quit 입니다.



아래는 debugfs: 에서 사용가능한 명령어들 입니다.
---------------------------------------------------------------------

Available debugfs requests:

show_debugfs_params, params
Show debugfs parameters
open_filesys, open Open a filesystem
close_filesys, close Close the filesystem
feature, features Set/print superblock features
dirty_filesys, dirty Mark the filesystem as dirty
init_filesys Initalize a filesystem (DESTROYS DATA)
show_super_stats, stats Show superblock statistics
ncheck Do inode->name translation
icheck Do block->inode translation
change_root_directory, chroot
Change root directory
change_working_directory, cd
Change working directory
list_directory, ls List directory
show_inode_info, stat Show inode information
link, ln Create directory link
unlink Delete a directory link
mkdir Create a directory
rmdir Remove a directory
rm Remove a file (unlink and kill_file, if
appropriate)
kill_file Deallocate an inode and its blocks
clri Clear an inode's contents
freei Clear an inode's in-use flag
seti Set an inode's in-use flag
testi Test an inode's in-use flag
freeb Clear a block's in-use flag
setb Set a block's in-use flag
testb Test a block's in-use flag
modify_inode, mi Modify an inode by structure
find_free_block, ffb Find free block(s)
find_free_inode, ffi Find free inode(s)
print_working_directory, pwd
Print current working directory
expand_dir, expand Expand directory
mknod Create a special file
list_deleted_inodes, lsdel
List deleted inodes
write Copy a file from your native filesystem
dump_inode, dump Dump an inode out to a file
cat Dump an inode out to stdout
lcd Change the current directory on your native
filesystem
rdump Recursively dump a directory to the native
filesystem
help Display info on command or topic.
list_requests, lr, ? List available commands.
quit, q Leave the subsystem.

from : kldp.org
2005/07/05 15:05 2005/07/05 15:05
2. Using Parted

2.1 Partitioning Concepts

Unfortunately, partitioning your disk is rather complicated. This is because there are interactions between many different systems that need to be taken into consideration:

The BIOS or firmware - the program that is built into a ROM chip inside your computer, that does memory checks, etc. You can not (easily) change programs in this system. Examples of BIOS or firmware programs: AmiBIOS, Award, Phoenix, OpenFirmware. You will only have one of these programs.
The boot loader - the program that allows you to select which operating system you want to use, and loads that operating system. Examples: LILO, GRUB, Yaboot, Quik. You may have more than one boot loader installed, especially if you have more than one type of operating system installed.
The operating system (at the moment, this must be GNU/Linux) that runs Parted, and the other operating systems that you use.
The file system types - the way the data stored on partitions. Examples of these are: ext2, fat32, hfs, reiserfs. You will often have partitions of of different file system types.
Parted suppports many combinations of BIOS, boot loader, operating system, and file systems, and will support more in the future. To further understand the roles of each, please see section 3. BIOSes and Firmware, section 4. Boot Loaders, section 5. Operating Systems, and section 6. File Systems supported by Parted.

This chapter describes how to use Parted, which is largely the same, no matter what systems you are using. You should read this chapter, then each of chapters on BIOSes, boot loaders, operating systems, and file systems. However, you only need to read the sections that are relevant to you. For example, if you are only using LILO as your boot loader, then you only need to read the introduction, and section 4.1 LILO: a bootloader for the Linux kernel.

2.2 Using GNU Parted

Parted has two modes: command line and interactive. Parted should always be started with:

# parted device

where device is the hard disk device to edit. (If you're lazy, Parted will attempt to guess which device you want.)

In command line mode, this is followed by one or more commands. For example:

# parted /dev/sda resize 1 52 104 mkfs 2 fat16

Options (like --help) can only be specified on the command line.

In interactive mode, commands are entered one at a time at a prompt, and modify the disk immediately. For example:

(parted) resize 1 52.0005 104.5
(parted) mkfs 2 fat16

Unambiguous abbreviations are allowed. For example, you can type "p" instead of "print", and "re" instead of "resize". Commands can be typed in, either in English, or your native language (if your language has been translated). This may create ambiguities.

Also note that you can specify decimal places in the numbers corresponding to partition locations (in megabytes). Negative numbers count from the end of the disk, with "-0" being the end of the disk.

If you don't give a parameter to a command, Parted will ask you for it. For example:

(parted) resize 1
Start? 0
End? 400

Parted will always warn you before doing something that is potentially dangerous, unless it's something that's obviosuly dangerous (i.e. rm, mklabel, mkfs) For example, if you attempt to shrink a partition "too much" (i.e. by more than the free space available), Parted will automatically resize to the minimum it can without losing data. If this minimum is significantly different, it will warn you that it's doing something significanlty different to what you asked. Since many partitioning systems have complicated constraints, Parted will usually do something slightly different to what you asked. (For example, create a partitiong starting at 10.352, not 10.4)

2.3 Command Line Options

When invoked from the command line, parted supports the following syntax:

# parted [option] device [command [argument]]

Available options and commands follow. For detailed explanations of the use of parted commands, see section 2.4 Parted Session Commands. Options begin with a hyphen, commands do not:

Options:

`-h'
`--help'
display a help message
`-i'
`--interactive'
where necessary, prompt for user intervention
`-s'
`--script'
never prompt for user intervention
`-v'
`--version'
display the version
2.4 Parted Session Commands

GNU Parted provides the following commands:

2.4.1 check


Command: check minor
Checks if the file system on partition minor has any errors.

Example:

(parted) check 1

Check the file system on partition 1.

2.4.2 cp


Command: cp [from-device] from-minor to-minor
Copies the file system on the partition from-minor to partition to-minor, deleting the original contents of the destination partition.

An optional device parameter, from-device can be given, which specifies which device the source partition is on.

Supported file systems:

ext2, ext3 (provided the destination partition is larger than the source partition)
fat16, fat32
linux-swap (equivalent to mkswap on destination partition)
reiserfs (if libreiserfs is installed)
Example:

(parted) cp /dev/hdb 2 3

Copy partition 2 of `/dev/hdb' (i.e. `/dev/hdb2') to partition on 3, on the device Parted was loaded with, destroying the original contents of partition 3.

2.4.3 help


Command: help [command]
Prints general help, or help on command.

Example:

(parted) help resize

Print help for the resize command.

2.4.4 mklabel


Command: mklabel label-type
Creates a new disk label, of type label-type. The new disk label will have no partitions. This command (normally) won't technically destroy your data, but it will make it will make it basically unusable, and you will need to use the rescue command (see section 9. Related Software and Info) to recover any partitions. Gpart only works for msdos disk labels (AFAIK), but is much better than parted at recovering partitions. Parted works on all partition tables. (1)

label-type must be one of these supported disk labels:

bsd
loop (raw disk access)
gpt
mac
msdos
pc98
sun
Example:

(parted) mklabel msdos

Create an msdos style disklabel.

2.4.5 mkfs


Command: mkfs minor fs-type
Makes a file system fs-type on partition minor, destroying all data that resides on that partition.

Supported file systems:

ext2
mips
fat16
fat32
linux-swap
reiserfs (if libreiserfs is installed)
Example:

(parted) mkfs 2 fat32

Make a fat32 file system on partition 2.

2.4.6 mkpart


Command: mkpart part-type [fs-type] start end
Creates a new partition, without creating a new file system on that partition. This is useful for creating partitions for file systems (or LVM, etc.) that Parted doesn't support. You may specify a file system type, to set the appropriate partition code in the partition table for the new partition. fs-type is required for data partitions (i.e., non-extended partitions). start and end are the offset from the beginning of the disk, that is, the "distance" from the start of the disk.

part-type is one of: primary, extended, logical. Extended and logical are only used for msdos and mips disk labels.

fs-type must be on of these supported file systems:

ext2
fat32
fat16
HFS
linux-swap
NTFS
reiserfs
ufs
Example:

(parted) mkpart logical 0.0 692.1

Create a logical partition that will contain an ext2 filesystem. The partition will start at the beginning of the disk, and end 692.1 megabytes into the disk.

2.4.7 mkpartfs


Command: mkpartfs part-type fs-type start end
Creates a new partition of type part-type with a new file system of type fs-type on it. The new partition will start start megabytes, and end end megabytes from the beginning of the disk. Do not use this command to recover a deleted partition (use mkpart instead).

part-type is one of: primary, extended, logical. Extended and logical are only used for msdos and mips disk labels.

fs-type must be one of these supported file systems:

ext2
fat32
fat16
linux-swap
reiserfs (if libreiserfs is installed)
Example:

(parted) mkpartfs logical ext2 440 670

Make a logical partition and write an ext2 file system, starting 440 megabytes and ending 670 megabytes from the beginning of the disk.

2.4.8 move


Command: move minor start [end]
Moves partition on the disk, by moving its beginning to start. Note: move never changes the minor number.

If no end is given, the partition's size remains the same.

Supported file systems:

ext2, ext3 (provided the destination partition is larger than the source partition)
fat32
fat16
linux-swap
reiserfs (if libreiserfs is installed)
Example:

(parted) move 2 150

Move partition with minor number 2 so that it begins 150 megabytes from the start of the disk.

2.4.9 name


Command: name minor name
Sets the name for the partition minor (Mac and PC98 only). The name can be placed in quotes.

Example:

(parted) name 2 'Secret Documents'

Set the name of partition 2 to `Secret Documents'.

2.4.10 print


Command: print
Displays the partition table on the device parted is editing.

Example:

(parted) print
Disk geometry for /dev/hda: 0.000-2445.679 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 945.000 primary FAT boot, lba
2 945.000 2358.562 primary ext2
3 2358.562 2445.187 primary linux-swap

2.4.11 quit


Command: quit
Quits Parted.

It is only after Parted exits that the Linux kernel knows about the changes Parted has made to the disks. However, the changes caused by typing your commands will probably be made to the disk immediately after typing a command. However, Linux's cache, and the disk's hardware cache may delay this.

2.4.12 rescue


Command: rescue start end
rescue a lost partition that used to be about start and end
Looks for file system signatures around start and end. If one is found, it will ask you if you want to create a partition for it. This is useful if you accidently deleted a partition with parted's rm command, for example.

Example:

(parted) print
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 8056.032 primary ext3
(parted) rm
Partition number? 1
(parted) print
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags

OUCH! We deleted our ext3 partition!!! Parted comes to the rescue...

(parted) rescue
Start? 0
End? 8056
Information: A ext3 primary partition was found at 0.031Mb ->
8056.030Mb. Do you want to add it to the partition table?
Yes/No/Cancel? y
(parted) print
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 8056.032 primary ext3

It's back! :)

2.4.13 resize


Command: resize minor start end
Resizes the partition with number minor. The partition will start start from the beginning of the disk, and end end from the beginning of the disk. resize never changes the minor number. Extended partitions can be resized, so long as the new extended partition completely contains all logical partitions.

Note that Parted does not require a file system to be "defragged" (Parted can safely move data around if necessary). It's a waste of time defragging. Don't bother!

Supported file systems:

ext2, ext3 - restriction: the new start must be the same as the old start.
fat16, fat32
linux-swap
reiserfs (if libreiserfs is installed)
Example:

(parted) resize 3 200 850

Resize partition 3, so that it begins 200 megabytes and ends 850 megabytes from the beginning of the disk.

2.4.14 rm


Command: rm minor
Removes the partition with number minor. If you accidently delete a partition with this command, use mkpart (not mkpartfs) to recover it. Also, you can use the gpart program (see section 9. Related Software and Info) to recover damaged disk labels.

Note for msdos disk labels: if you delete a logical partition, all logical partitions with a larger minor number will be renumbered. For example, if you delete a logical partition with a minor number of 6, then logical partitions that were number 7, 8 and 9 would be renumbered to 6, 7 and 8 respectively. This means, for example, that you have to update `/etc/fstab' on GNU/Linux systems.

Example:

(parted) rm 3

Remove partition 3.

2.4.15 select


Command: select device
Selects the device, device, for Parted to edit. The device will usually be a Linux hard disk device, or, if direct access to a file system is required -- a partition, software RAID device, or LVM logical volume.

Example:

(parted) select /dev/hdb

Select `/dev/hdb' (the slave device on the first ide controller on Linux) as the device to edit.

2.4.16 set


Command: set minor flag state
Changes a flag on the partition with number minor. A flag can be either "on" or "off". Some or all of these flags will be available, depending on what disk label you are using:

`boot'
(Mac, MSDOS, PC98) - should be enabled if you want to boot off the partition. The semantics vary between disk labels. For MSDOS disk labels, only one partition can be bootable. If you are installing LILO on a partition (see section 4.1 LILO: a bootloader for the Linux kernel), then that partition must be bootable. For PC98 disk labels, all ext2 partitions must be bootable (this is enforced by Parted).
`lba'
(MSDOS) - this flag can be enabled, to tell MS DOS, MS Windows 9x and MS Windows ME based operating systems to use Linear (LBA) mode.
`root'
(Mac) - this flag should be enabled if the partition is the root device to be used by Linux.
`swap'
(Mac) - this flag should be enabled if the partition is the swap device to be used by Linux.
`hidden'
(MSDOS, PC98) - this flag can be enabled to hide partitions from Microsoft operating systems.
`raid'
(MSDOS) - this flag can be enabled to tell linux the partition is a software RAID partition See section 7. LVM and RAID.
`LVM'
(MSDOS) - this flag can be enabled to tell linux the partition is a physical volume.
The print command displays all enabled flags for each partition.

Example:

(parted) set 1 boot on

Set the `boot' flag on partition 1.

2.5 Example Parted Sessions

These examples attempt to cover the most common circumstances, with the exception of disk imaging, which is covered in section 8. Disk Imaging.

2.5.1 Example: Growing a partition into unused space

Suppose your disk layout looks like this:

(parted) print
Disk geometry for /dev/hda: 0.000-1000.000 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.063 500.000 primary ext2
2 500.000 625.000 primary linux-swap

There is 375 Mb of free space at the end of the disk (after partition 2). Partition 1 has an ext2 file system, which is the root device. Partition 2 is a swap device.

Suppose you wanted to use the free space at the end of the disk for the file system on partition 1. You could do the following:

These steps will modify both the root file system on partition 1, and the swap device on partition 2. Therefore, you shouldn't be using either partitions. You should probably use a Parted boot disk. See section 1.6 Using a Parted Boot Disk. From the boot disk, run Parted:
# parted /dev/hda

Remove partition 2 (the swap partition). Normally, you wouldn't want to delete a partition with data on it. However, a swap partition doesn't contain data when it isn't "swapped on" (mounted), so you can remove it, and create a replacement swap partition later.
(parted) rm 2

Create the new swap partition at the end of the disk:
(parted) mkpartfs primary linux-swap 875 999.9
(parted) print
Disk geometry for /dev/hda: 0.000-1000.000 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.063 500.000 primary ext2
2 875.000 1000.000 primary linux-swap

Grow partition 1, into the adjacent free space:
(parted) resize 1 0.063 874.9

All done!
(parted) print
Disk geometry for /dev/hda: 0.000-1000.000 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.063 874.999 primary ext2
2 875.000 1000.000 primary linux-swap

2.5.2 Example: Resizing an ext2 partition on a crowded disk.

Suppose your disk layout looks like this:

(parted) print
Disk geometry for /dev/hda: 0-8063.5 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.0 23.5 primary ext2 boot
2 23.5 8056.0 extended
5 23.6 3545.6 logical ext2
6 3545.6 7067.7 logical ext2
7 7067.7 7326.5 logical ext2
8 7326.5 7585.4 logical ext2
9 7585.4 7844.2 logical linux-swap

$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 251M 31M 207M 13% /
/dev/hda1 23M 2.4M 19M 11% /boot
/dev/hda5 3.4G 577M 2.7G 18% /usr
/dev/hda6 3.4G 289M 2.9G 9% /home
/dev/hda7 251M 12M 226M 5% /var

Suppose you wanted to increase the `/var' partition (`/dev/hda7') to 1GB, using some space from `/home' (`/dev/hda6').

To resize a partition with Parted, you use the resize command:

(parted) resize partition_number new start new end

new start must be the same as the old start for ext2 partitions (unfortunately). So this process is going to be rather complicated. It is possible, though. (2)

Shrink the `/home' partition (`/dev/hda6') by 500MB:
# parted /dev/hda
(parted) resize 6 3545.6 6200

Make a new partition in its place. This is where `/var' will be, eventually. This new partition will be numbered 10.
(parted) mkpartfs logical ext2 6200 7067.7

Copy the old `/var' partition (`/dev/hda7') to the new one (`/dev/hda10').
(parted) cp 7 10

Delete the old `/var'.
(parted) rm 7

At this point: all logical partitions greater than 7 just changed number. So 8, 9 and 10 become 7, 8 and 9 respectively. This renumbering won't take place while any partitions are mounted on that disk (this will happen when you reboot). That's what that warning message is talking about. So you should never attempt to mount a file system touched by Parted (resized or created by Parted), before rebooting, if you get this message.
Resize the new `/var' partition (now numbered 9), adding the space from the old `/var' partition:
(parted) resize 9 6200 7326.5
(parted) quit
Warning: The kernel was unable to re-read the partition table on
/dev/hda (Device or resource busy). This means Linux knows nothing
about any modifications you made. You should reboot your computer
before doing anything with /dev/hda.

Since the partition numbers have changed, `/etc/fstab' must be updated. This can be done before rebooting, because the root device wasn't touched by Parted. (If you want to use Parted to do something to the root device, you need to use the boot disk). If the old `/etc/fstab' looks like this:
/dev/hda8 / ext2 defaults 1 1
/dev/hda1 /boot ext2 defaults 1 2
/dev/hda6 /home ext2 grpquota,usrquota 0 2
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/hda5 /usr ext2 defaults 1 2
/dev/hda7 /var ext2 grpquota,usrquota 0 2
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hda9 swap swap defaults 0 0

A few lines need to be changed:
`/var' is now /dev/hda9 (because we copied it to a new partition)
`/dev/hda8' (the root device) has been renumbered to `/dev/hda7'
`/dev/hda9' (the swap device) has been renumbered to `/dev/hda8'
The new `/etc/fstab' looks like this:
/dev/hda7 / ext2 defaults 1 1
/dev/hda1 /boot ext2 defaults 1 2
/dev/hda6 /home ext2 grpquota,usrquota 0 2
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/hda5 /usr ext2 defaults 1 2
/dev/hda9 /var ext2 grpquota,usrquota 0 2
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hda8 swap swap defaults 0 0

Reboot. That's it!
2005/07/05 15:05 2005/07/05 15:05
/usr/local/apache/conf/php.ini

에서 수정한다. 위 php.ini 파일을 열어보면

upload_max_filesize 라는 항목이 보인다.

디폴트로 8M가로 되어 있다 . 여기서 원하는 파일 용량을 수정하고

저장 하면 된다. 저장후엔 반드시 apache 를 restart 해줘야 적용이된다.

단 memory_limit 항목이 업로드 항목보다 사이즈가 크지 않도록

조정한다. memory_limit 의 디폴트는 8M로 되어 있다.
2005/07/05 15:04 2005/07/05 15:04
최신 하드웨어의 경우 리눅스에서 드라이버가 잡히지 않을 경우가 있습니다.
LAN 카드를 예로 들어서 설치 방법을 설명 하겠습니다.

우선 해당 하드웨어사의 홈페이지로 들어가서 리눅스용 최신 드라이버를 다운로드
후 (보통 ***.tar.gz의 형태로 제공) 적당한 폴더로 업로드 합니다.

ex) 3com사의 랜카드 3c2000을 예로 함.

1. 업로드한 폴더의 압축 해제
#tar xvzf 3c2000.tar.gz

2. 압축을 푼 드라이버 폴더로 들어가서 make install
(해당 드라이버에 따라 다를 수 있음)
#cd 3c2000
#make install

3. modinfo 명령으로 모듈 확인
#modinfo
3c2000 ---> 설치된 모듈 확인

4. 위의 명령으로 모듈이 올라오지 않았다면 드라이버 압축을 풀었던
폴더로 이동하여 Makefile이 있는 폴더 안에서
insmod 3c2000.o라고 칩니다. 여기서 .o는 object 파일을 의미함
#insmod 3c2000.o

5. 그 이후 ifconfig eth0 up(또는 해당 이더넷 eth1등... )
#ifconfig eth0 up

6. modules.conf 내용에서 모듈명 등록
#vi /etc/modules.conf
alias eth0 3c2000 <--- 해당 라인을 입력
:wq <--- 저장

7. 마지막으로 부팅시 모듈을 찾을 수 있도록 depmod -a라는 명령어를 칩니다.
#depmod -a
#modinfo --> 모듈이 올라왔는지 다시 확인
2005/07/05 15:03 2005/07/05 15:03
보통 시스템 모니터링을 하기 위해서 linux에서 많이 사용하고
있는 top이라는 프로그램을 많이 설치하고 사용하고 있다.

솔라리스에서도 이와 같은 기능을 하는 프로그램이 있는데
많이 알려지지 않아서 사용하고 있지 않은데 top가 없는
시스템에서 top와 같은 프로그램이 필요할때 사용하면
유용하다.

prstat 라는 프로그램인데 한번 사용해 보기를 권장합니다.
2005/07/05 15:02 2005/07/05 15:02
보통, 솔라리스에서 유저를 추가/삭제/수정하기 위해서
useradd/userdel/usermod라는 명령어를
주로 이용하고 있는데, 이것 못지 않게 좋은 프로그램이 있다.
passmgmt라는 명령어를 이용하면 된다.
사용법은 다음과 같다.
passmgmt -a [-c comment] [-h homedir] [-u uid [-o]] [-g gid]
[-s shell] [-f inactive] [-e expire] name
passmgmt -m -c comment | -h homedir | -u uid [-o] | -g gid |
-s shell | -f inactive | -e expire | -l logname name
passmgmt -d name

passmgmt라는 명령어를 사용하여 유저를 추가해 보겠다.
passmgmt -a -h /export/home/gdhong -s /bin/bash gdhong
수정시
passmgmt -m -s /bin/csh gdhong
삭제시
passmgmt -d gdhong
2005/07/05 15:01 2005/07/05 15:01
유닉스/리눅스에서 inode 사용량 보는 방법은 의외로 간다하다.

우리가 많이 사용하고 있는 df 라는 프로그램을 이용하여
현재 사용하고 있는 inode 사용량을 볼수 있다.
명령어는 다음과 같다.
------
df -i
------

또한, 디스크 용량을 보기 위해서
df -k 를 주로 많이 사용하고 있는데 df -h를 사용하면 보기가
더 간단하게 디스크 사용량을 볼 수 있다.
솔라리스 9 이하에서는 df -h를 지원해 주지 않기 때문에
gnu fileutils라는 프로그램을 설치해주면 볼수있다.
2005/07/05 15:01 2005/07/05 15:01
snmp에 새로운 mib값을 추가히기 위해서는 다음과 같은 작업을 해야 한다.
만약 snmp 를 /usr/local/snmp라는 곳에 설치를 했다며
--------------
cd /usr/local/snmp/share/snmp/mibs에 가보면
.index라는 파일이 있을 것이다.

이파일을 지우고 나서 snmpd 데몬을
스타트 시키면 자동으로 추가가 됩니다.
2005/07/05 15:00 2005/07/05 15:00
telnet 를 사용하여 솔라리스에 접속할려고 하는데
접속이 안될때에는 다음과 같은 사항을 확인해 보기 바랍니다.
물론, 이것은 telnet 데몬이 실행 하고 있다는 가정하에 작성된
글입니다.


첫번째, tcp_wrappers를 사용하고 있다면
/etc/hosts.allow /etc/hosts.deny를 점검해 보고 접속하고자 하는
클라이언트 아이피가 /etc/hosts.allow에 있는지 확인해 봐야 한다.
두번째, 솔라리스에서는 기본적으로 /etc/shells라는 파일이 생성되지는 않지만
이파일이 존재 한다면 그 파일 내용을 확인해 봐야 한다.
이 파일은 shell과 쉘의 경로의 리스트가 들어가 있는데, 접속하고자
하는 유저 기본 쉘이 /etc/shells라는 파일안에 있는지 확인해 봐야 한다.
없는 경우 접속이 안된다. 아예, /etc/shells라는 파일이 없다면 해당하지
않는다.

마지막으로, firewall, 포트가 23인지 , 유저가 등록되어 있는지 확인해 보면 된다.
2005/07/05 15:00 2005/07/05 15:00
센드 메일 보안설정하기.

O PrivacyOptions에
goaway => SMTP에서 EXPN, VRFY명령어를 사용하는 스패머를 막기위해 사용.
SMTP에서 VERB 명령어 거절.

restrictmailq => mailq 명령어를 사용하여 queue's contents실행 막기
1) chmod 0700 /var/spool/mqueue
2) PrivacyOtions에 restrictmailq추가.
restrictqrun => sendmail -q 사용을 제한.(root 및 queue소유자만 접근가능)

ex) PrivacyOptions=authwarnings,goaway,restrictmailq,restrictqrun

SMTP greeting messages
O SmtpGreetingMessages=$j Sendmail $v/$Z;$b는
sendmail에 해당하는 버전 및 날짜/시간대 표시
------------------------------------------------
telnet mailserver 25
220 mailserver.xxxx.net ESMTP Sendmail 8.11.6/8.11.6;
Fri, 6 Sep 2003 11:06:25 +0900
------------------------------------------------

Linux는 chattr를 사용하여 중요한 파일에 접근 제한.
sendmail.cf, local-host-names, access, etc등...
chattr +i sendmail.cf

aliases파일에 쓸데없는 aliases삭제하기.
uucp, nuucp, listen, www 등등.

smrsh사용하기.
The Sendmail restricted shell(smrsh)
sendmail은 프로그램 mailer에서 /bin/sh를 사용하는데, 이설정은
외부로부터 공격에 노출될 경우...여러 다른프로그램을 실행시킬수 있게
하는 취약점이 있고,,이것을 대치하는것이 smrsh이다.
smrsh는 sendmail에서 실행시킬수 있는 프로그램을 제한해 /etc/smarsh에
있는 프로그램만 실행시킬수 있게하는 shell이다.

예를 들어...우리가 사용하고 있는 mail, procmail등을 smrsh를 사용해서
적용할수 있는데..사용법은 어렵지 않다.
cd /etc/smrsh로 이동
ln -s /usr/bin/procmail procmail
ln -s /bin/mail mail
이런식으로 /etc/smrsh로 링크만 시켜주면 된다.

수정해야 할 부분은 sendmail.cf에서
Mprog, P=/bin/sh => P=/usr/sbin/smrsh로 변경.


*)mailq, praliases, sendmail, newaliases, mailstats, makemap
파일은 일반 유저가 실행할수 없게 해야 하며,
특정한 그룹을 줘서 그룹에 속한 유저만 실행시킬수 있게 해야함.
2005/07/05 14:59 2005/07/05 14:59