블로그 이미지
Flying Mr.Cheon youGom

Recent Comment»

Recent Post»

Recent Trackback»

« 2025/5 »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

 
 

/etc/skel 디렉토리 속에 public_html 디렉토리를 만들어 놓은 후에 사용자를 생성하면 됩니다.

/etc/skel 디렉토리 속의 내용을 새로생성되는 사용자의 홈디렉토리 속에 copy하는 것이 adduser 명령어가 하는 일 중의 하나입니다. 그렇기 때문에 adduser 명령으로 사용자를 추가하기 전에 /etc/skel/public_html 을 만들어 놓으면 adduser 명령으로 사용자를 추가할 때마다 사용자의 홈디렉토리에 public_html 디렉토리가 생성됩니다.

index 화일을 미리 만들어 /etc/skel/public_html/ 속에 넣어두고 사용자를 생성하면 index 페이지도 사용자 홈디렉토리 밑의 public_html 에 복사되겠지요?

 

:

- 클리앙
- 디시인사이드
- 야놀자
-

'재밌는 흔적 > 즐겨찾기 - 사이트' 카테고리의 다른 글

google, go 언어 참조 사이트  (0) 2012.02.14
부동산 관련  (0) 2012.01.31
인용구 사이트 모음  (0) 2011.12.28
외국어 ( 영어 )  (0) 2011.07.21
코드 분석  (0) 2011.07.07
:

우분투 Bind9 설치 / 네임서버 설정

보안/서버관리 | 2011. 12. 20. 20:12 | Posted by youGom

1. Bind9 설치

 

$ sudo apt-get install bind9

 

2. zone 파일 등록

$ sudo gedit /etc/bind/named.conf.local

//
// Do any local configuration here
//
zone "domain.com" {
        type master;
        file "/etc/bind/db.domain.com";
};   // <- 괄호 뒤 세미콜른 잊지 말것


3. zone 파일 작성

$ sudo cp /etc/bind/db.local /etc/bind/db.domain.com

 


$ sudo vi /etc/bind/db.domain.com

$ vi /etc/bind/db.domain.com

;
; BIND data file for local loopback interface
;

$TTL    604800
@       IN      SOA   ns.domain.com.    root.domain.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS     ns.domain.com.
@       IN      A       111.222.333.444
www  IN      A       111.222.333.444
mail    IN      A       111.222.333.444
*        IN      A       111.222.333.444

 

4. bind9 재시작

      설정이 잘 되었는지 확인하는 방법 ( 재시작 전에 확인해 본다 )

$ named-checkzone example.com /etc/bind/db.example.com
zone example.com/IN: loaded serial 5
OK

$ sudo /etc/init.d/bind9 restart

 

5. VirtualHost 설정

 

$ sudo vi /etc/apache2/sites-available/domain-name

 

<VirtualHost *:80>

ServerAdmin admin@localhost

DocumentRoot /home/유저폴더

ServerName domain.com

ServerAlias www.domain.com

CustomLog /home/유저폴더/access.log combined

ErrorLog /home/유저폴더/error.log

<Directory /home/유저폴더/ >

Options FollowSymLinks MultiViews

AllowOverride All

php_admin_value open_basedir /home/유저폴더/public_html/:/var/tmp/:/tmp/

</directory>

</VirtualHost>

 

$ sudo a2ensite domain-name

 

$ /etc/init.d/apache2 restart 

 

 

참고) 유저가 모든 활동을 할 수 있게 만드는 과정

  1. 우분투 로컬 계정 생성
    adduser 유저명, passwd 유저명 
  2. 유저 mysql 계정 생성
    1. mysql 접속 ( mysql -u root -p : 루트계정으로 접속 )
    2. 데이터베이스 생성 ( CREATE DATABASE 디비명; )
    3. mysql 계정 생성
    ( GRANT ALL PRIVILEGES ON 디비명.* TO 계정명@localhost IDENTIFIED BY ‘계정암호’ WITH GRANT OPTION; )
  3. 생성된 유저폴더에 가상호스트를 설정합니다.

'보안 > 서버관리' 카테고리의 다른 글

IP공유기, DNSEVER, DDNS, NS(NAMESERVER), XE  (0) 2011.12.20
xshell  (0) 2011.12.20
ubuntu_server에서 할글 깨짐 현상 해결  (0) 2011.12.19
DB, MySQL 계정 생성  (0) 2011.12.19
우분투 원격 부팅 설정  (0) 2011.12.17
:

ubuntu_server에서 할글 깨짐 현상 해결

보안/서버관리 | 2011. 12. 19. 23:47 | Posted by youGom
ubuntu desktop 에디션을 사용중인데, 여기선 한글 깨짐등의 문제가 생길 때는 간편하게
"시스템 -> 관리 -> 언어" 에서 간편하게 해결이 되지만 

서버버젼이나 SSH로 사용중에 한글깨짐 현상은 예전에 콘솔에서 하던 방법으로 해결해야 한다.
자주 사용하지 않다 보니 이것도 깜빡 깜빡해서 여기다 정리해 둔다.

요즘은 이 블로그가 내 개인 메모장인지 블로그인지 혼돈이 간다 .^^
뭐 어떤가 ... 단 한사람이라도 이글이 도움이 된다면 된거 아닌가.

뭐 대충 이렇게 깨져 나온다.

locale 해서 보게 되면 LANG=ko_KR.UTF-8만 나온다. 여기다가 EUC-KR만 추가해 주면 된다.

1. EUC-KR 추가

code:
$ sudo apt-get install language-pack-ko
$ sudo locale-gen ko_KR.EUC-KR

2.  환경설정

code:
$ vi /etc/environment 로 들어가서

LANG="ko_KR.UTF-8"
LANG="ko_KR.EUC-KR"
LANGUAGE="ko_KR:ko:en_GB:en"

위를 추가해 주고 저장한다.

3. rebooting 해서 사용하면 됩니다.



출처 : http://nokia.egloos.com/9676842



'보안 > 서버관리' 카테고리의 다른 글

xshell  (0) 2011.12.20
우분투 Bind9 설치 / 네임서버 설정  (0) 2011.12.20
DB, MySQL 계정 생성  (0) 2011.12.19
우분투 원격 부팅 설정  (0) 2011.12.17
apache2 디렉토리 인덱싱 안되게 하기  (0) 2011.12.16
:

우분투 원격 부팅 설정

보안/서버관리 | 2011. 12. 17. 13:53 | Posted by youGom

ethtool -s eth0 wol g



-------------------------------------------------------------------------------------------------------

HOWTO: Set your system up for Wake On LAN (WOL)

This is really common, but I haven't seen a ubuntu howto for it, people more or less peice it together from posts and blog entries and the like.

So, here it goes. First off, make sure your system supports WakeOnLAN (WOL), if you know your system well, you already know if it does or doesn't.

--

Automatic way:
This script does everything described in the Manual way, for you, except step 1 and step 4.
------------------------

The automatic method is super dialup friendly! thanks to gzip compression the filesize is a mere 1.5kb! almost half the extracted size of 3.4kb!


1. If you havent already, go to your BIOS, and turn on WakeOnLAN (it varies, look for it.) If your network card is onboard, your set for step 2, otherwise there is probably a cable that should go from your network card to your motherboard, though this is not always the case.


Before continuing, note the interface you want to do this to. Most people know how to do this, if you do not, look at step 2a of the manual method.

2. Download and extract this: You can do it with the GUI and run the extracted program in a terminal by double clicking it, or open a terminal and do the following:

**** Removed dead link ****

3. As the exit of the program notes, now you just need to get/use a wake on lan sending program, like wakeonlan.

4. Sit on your lazy *** and have fun

--

Manual way:
------------------------
1. If you havent already, go to your BIOS, and turn on WakeOnLAN (it varies, look for it.) If your network card is onboard, your set for step 2, otherwise there is probably a cable that should go from your network card to your motherboard, though this is not always the case.

2. Back in ubuntu, kubuntu, xubuntu, w/e, we now need to make a script that will run every time the computer is started, because this command only lasts until the computer is turned on again once.

2a. Find out what network device you want to have the computer wake-able from, usually all, which is just one. If you have more network devices in your system, 9 chances out of 10, you already know what they are called.
You can NOT wake up a laptop or computer that is only connected via wireless with wake-on-lan, unless the bios has a method for this, this is very rare, and I do not garuntee this howto will work in such cases.
In your terminal, type:
Code:
ifconfig
You'll get something like: (I have removed my mac address for security)
Code:
eth0      Link encap:Ethernet  HWaddr 01:23:45:67:89:ab
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::215:f2ff:fe6f:3487/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:71495 errors:0 dropped:0 overruns:0 frame:0
          TX packets:76190 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:23164212 (22.0 MiB)  TX bytes:7625016 (7.2 MiB)
          Interrupt:217 Base address:0xd400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1290 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1290 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:161182 (157.4 KiB)  TX bytes:161182 (157.4 KiB)
So, I want this system to be wake-able from eth0.

2b. Now we create the script.
Note: you must be an administrator on the system you are doing this to.
Code:
sudo -i
Enter your password at the prompt.
Change to the startup script directory and start editing a new file:
Code:
cd /etc/init.d/
pico wakeonlanconfig
Paste, or type this into the file, replacing eth0 with your network device, repeat the ethtool line as many times for your devices before the exit line:
Code:
#!/bin/bash
ethtool -s eth0 wol g
exit
Set the permissions of the file:
Code:
chmod a+x wakeonlanconfig
Make the script run on startup:
Code:
update-rc.d -f wakeonlanconfig defaults
You should see something like:
Code:
 Adding system startup for /etc/init.d/wakeonlanconfig ...
   /etc/rc0.d/K20wakeonlanconfig -> ../init.d/wakeonlanconfig
   /etc/rc1.d/K20wakeonlanconfig -> ../init.d/wakeonlanconfig
   /etc/rc6.d/K20wakeonlanconfig -> ../init.d/wakeonlanconfig
   /etc/rc2.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
   /etc/rc3.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
   /etc/rc4.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
   /etc/rc5.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
Now we finish by running it, and making sure there are no errors.
Code:
/etc/init.d/wakeonlanconfig
This should produce no output and put you right back at the prompt you started at.

3. Use it. you'll need something to send wake-on-lan packets with, "wakeonlan" is in the repos. And you'll need the mac address of the system.

To get your MAC address, on the same system you just enabled WOL on, type:
Code:
ifconfig | grep HW
its the thing that looks like 01:23:45:67:89:ab , write it down.
turn off that system:
Code:
sudo halt
if your using wakeonlan from the repos, and you are on the same network as the computer your tying to wake up, replace 01:23:45:67:89:ab with your mac address and do, from another computer:
Code:
wakeonlan 01:23:45:67:89:ab
In MOST cases, you CAN SEND wake on lan packets from a wireless connected computer.
If that doesnt work, its likely the port on the system your trying to wake up isnt the default (9), try 7, or if your BIOS settings or book told you one, use that one.
Code:
wakeonlan -p 7 01:23:45:67:89:ab
If that STILL doesnt work, make sure wakeonlan is enabled in your bios and your hardware supports it.

*Note: It has been said that you need to disable -i from halt, however I have never had to do this, nor do I know how.

4. Sit on your lazy *** and have fun

Feel free to post any questions, suggestions, problems and I will tend to them ASAP.

Added notes:
* For this to work, most systems must be shut down properly, ie: with the power button or halt, or any of the ways to shut down. Unclean power-offs (like a power outage or holding the power button for 5s) seem to stop WOL from working untill the system is powered on and shut down properly. Though, there my be a few exceptions. This is a hardware issue with the BIOS. In my opinion, WOL should work regardless of how the system is powered off, but thats not the case. I suggest, if you have frequent power outages, that you have your BIOS set to Power ON after a power failure, most new systems allow this.
:

apache2 디렉토리 인덱싱 안되게 하기

보안/서버관리 | 2011. 12. 16. 17:56 | Posted by youGom

웹서버를 설치 하고 나면 기본적으로 index.html 파일이 생성되면서
"It Work!" 라는 단어를 출력한다.
하지만 그 index 관련 파일이 없게 되면
index of ~ 와 함께 그 폴더에 있는 모든 파일을 다운로드 가능하게 열람 할 수 있다.
이는 보안적 측면에서 너무나 취약한 점이다.

이를 막기 위해서 다음과 같은 파일을 수정해 주면 된다.

/etc/apache2/mods-available/userdir.conf 파일에 존재하는 

<Directory /home/*/public_html>
                AllowOverride FileInfo AuthConfig Limit Indexes
#               Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                Options MultiViews SymLinksIfOwnerMatch IncludesNoExec

                <Limit GET POST OPTIONS>
                       Order allow,deny
                        Allow from all
                </Limit>
                <LimitExcept GET POST OPTIONS>
                        Order deny,allow
                        Deny from all
                </LimitExcept>
        </Directory>

위와 같이 Indexes 를 없애주면 된다.

출처 : http://gmyoul.tistory.com/entry/apache2-디렉토리-인덱싱-안되게-하기

:

개인도메인만들기/네임서버설정

보안/서버관리 | 2011. 12. 16. 17:54 | Posted by youGom

/개인도메인등록 과정이 끝나면, 이 도메인을 홈페이지가 있는 호스트로 연결하기 위하여 최소 하나의 네임서버에 이 도메인을 위한 엔트리를 설정해 주어야 한다.

1. 상황
2. 어느 네임서버를 이용할 것인가
3. 네임서버 설치와 설정
3.1. /etc/named.conf 변경
3.2. /var/named/zone-gypark.pe.kr 추가
3.3. 네임서버 구동
4. 네임서버 동작 확인

[edit]1. 상황

  • 도메인 : gypark.pe.kr
  • 실제주소 : http://HHHHHH.snu.ac.kr/~gypark새 창으로 열기
  • 실제호스트 : HHHHHH.snu.ac.kr (147.46.15.HHH)
  • 네임서버 : NNNNNN.snu.ac.kr (147.46.15.NNN)

[edit]2. 어느 네임서버를 이용할 것인가

문제는 어느 네임서버에서 그 설정을 해 줄 것인가 하는 점. 크게 네 가지 길이 있었다.

  • 서울대 네임서버 (147.46.80.1,147.46.80.2) 를 사용
    • 호스트가 서울대 내에 있는 것이기 때문에, 호스트가 위치한 전산망의 공식 네임서버를 사용하는 것이니 개념상 꽤 합당해보였다.
    • 전산원에서 관리하는 학내 공식 서버인만큼, 안정성이 보장된다.
    • but, 전산원에 전화로 문의한 결과, 서울대 전산원에서는 snu.ac.kr 로 끝나는 도메인 이외의 다른 도메인을 사용하는 것은 지원을 해 줄 수 없다는 답변을 받았다. 이 때 처음 알았는데, 학내에 있는 호스트에 다른 도메인을 사용한 경우는 전부 몰래(?) 하는 것이고, 전산원에서는 현재는 이를 묵인하고 있지만, 나중에 정책 변경 여하에 따라 이런 경우를 적발하여 차단할 수 있다고 한다.

  • 외부 업체에서 제공하는 도메인 포워딩을 이용
    • (주)아이네임즈에서는 도메인 포워딩 서비스에 별도의 이용료를 받고 있었고, (주)아사달에서는 무료로 서비스를 제공하고 있었다. 그래서 일단 아사달에 회원 가입을 하고, 도메인 포워딩 서비스를 신청하였다.
    • /개인도메인의네임서버지정 과정을 통해서, 내 도메인의 네임서버를 아사달에서 공지한 네임서버로 설정하였다. (p1.asadal.net 211.233.39.186 , p2.asadal.net 211.233.38.28)
    • but, 결과가 상당히 불만족스러웠다. "유동 포워딩"과 "고정 포워딩" 두 가지 방식 중에서 선택할 수 있도록 되어 있었는데, 유동 포워딩 방식에서는, 웹브라우저의 주소창에 gypark.pe.kr 을 입력하면 그 주소를 실제 주소로 변경하여 refresh 하는 방식이다. 따라서 주소창에 실제 주소가 나타나 버린다. 고정 포워딩 방식에서는, gypark.pe.kr 로 접속했을 때 아사달 측의 서버에서 하나의 프레임으로 구성된 프레임셋을 출력하고, 그 프레임 안에 실제 주소의 페이지를 집어넣는 방식이다. 주소창의 도메인은 바뀌지 않지만, 내부에 있는 링크들은 모두 원래의 주소 그대로 나온다. 게다가 두 방식 모두, gypark.pe.kr/DateBK5/index.html 과 같이 하위 디렉토리나 파일을 직접 주소에 적어서 억세스하는 것이 불가능하다.

  • 다른 네임서버를 이용
    • 누군가의 컴퓨터에 설치되어 동작하고 있는 네임서버를 이용하는 방법
    • 실제로 특정한 동호회나 동문회 사람들끼리 하나의 네임서버를 운영하여 구성원들의 도메인을 담당하게 하는 경우를 볼 수 있다.
    • but, 네임서버 관리자와 친분이 있지 않으면 부탁하기 힘들다. :-) 게다가, 그 네임서버의 안정성을 신뢰하기 힘들다.

  • 홈페이지가 있는 서버 (HHHHHH.snu.ac.kr) 에서 직접 네임서버를 운영
    • 네임서버 관리의 권한이 연구실에 있으므로 설정 변경 등을 맘대로 할 수 있다.
    • 네트웍 안정성이 큰 문제가 되지 않는다. (네임서버가 접속이 안 되는 상황이라면 어차피 홈페이지도 접속이 안 된다는 것이니..)
    • but, 네임서버 설정하는 것에 전혀 문외한이었고, 무엇보다도 네임서버는 외부 공격에 매우 취약하여 보안상 문제점이 많다. 웬만한 해킹 사례를 보면 bind 나 기타 nameserver 의 헛점을 노렸다는 얘기는 빠지지 않고 나온다. 항상 보안 관련 뉴스에 귀기울여야 함.

처음에는 네번째 방법, 즉 HHHHHH에 직접 네임서버를 설치하는 것을 택했는데, HHHHHH가 연구실에서 꽤 중요한 비중을 차지하는 서버이기 때문에 아무래도 맘에 걸려서, 세번째 방법과 결합하였다. 즉 연구실 내 다른 서버(NNNNNN)에 네임서버를 설치하고 운영하기로 하였다.

[edit]3. 네임서버 설치와 설정

NNNNNN 에는 레드햇 리눅스가 설치되어 있었고, bind-9.*.* 이 이미 설치되어 있었다. 따라서 설정만 변경해 주고 구동하면 되었다. (소스를 직접 컴파일하는 경우는 http://www.isc.org새 창으로 열기 에서 최신 버전을 다운로드 할 수 있다. (이 사이트는 하나로통신을통해접속할수없는웹사이트들 중 하나이다.)

다음의 화일들을 수정 또는 추가하였다. 전혀 모르는 상태에서 여러 웹사이트들을 뒤지면서 끙끙대었음...

[edit]3.1. /etc/named.conf 변경

options {
    directory "/var/named";
    /*
     * If there is a firewall between you and nameservers you want
     * to talk to, you might need to uncomment the query-source
     * directive below.  Previous versions of BIND always asked
     * questions using port 53, but BIND 8.1 uses an unprivileged
     * port by default.
     */
    // query-source address * port 53;
    // 아래 네 줄을 추가
    allow-transfer { none; };   // 다른 네임서버에서 zone 설정을 가져가지 못하게 한다
    allow-query { none; };      // 기본적으로 모든 네임서버 질의에 응답하지 않는다. 
                                // 따라서 이 서버를 DNS 서버로 지정하여 사용할 수는 없다.
    recursion no;               // 역시 보안을 고려하여 recursive 모드 금지
    version "No!!";
};

(중략)

// 아래의 zone 설정을 추가
zone "gypark.pe.kr" IN {
    type master;
    file "zone-gypark.pe.kr";    // 이 화일을 /var/named 에 추가해주어야 함
    notify no;
    allow-query { any; };        // 이 도메인에 대한 질의에만 응답한다.
    allow-update { none; };
    allow-transfer { none; };
};

(이하 생략)

[edit]3.2. /var/named/zone-gypark.pe.kr 추가

$TTL  3600
@   IN    SOA    ns.gypark.pe.kr.     gypark.HHHHHH.snu.ac.kr.    (
    2002091501         ; Serial
    84600              ; Refresh
    1800               ; Retry
    1209600            ; Expire
    3600  )            ; Minimum

    IN    NS     ns.gypark.pe.kr.

ns                   IN    A    147.46.15.NNN   ; ns.gypark.pe.kr 은 NNNNNN
gypark.pe.kr.        IN    A    147.46.15.HHH   ; gypark.pe.kr 은 HHHHHH
www.gypark.pe.kr.    IN    A    147.46.15.HHH   ; www.gypark.pe.kr 도 HHHHHH 의 IP 를 사용

[edit]3.3. 네임서버 구동

/etc/init.d/named start

부팅시 자동으로 구동되도록 하기 위해 /etc/rc.local 화일에 다음의 항목을 추가하였다.

/etc/init.d/named start &

[edit]4. 네임서버 동작 확인

nslookup 을 사용하여 네임서버의 동작을 확인한다. 다음의 과정을 통해서 새로 설치한 네임서버가 제대로 동작하는 것을 알 수 있다.
raymundo@raymundus:~$ nslookup
Note:  nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead.  Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
> server 147.46.15.NNN               (NNNNNN 을 네임서버로 지정)
Default server: 147.46.15.NNN
Address: 147.46.15.NNN#53
> ns.gypark.pe.kr
Server:         147.46.15.NNN
Address:        147.46.15.NNN#53

Name:   ns.gypark.pe.kr
Address: 147.46.15.NNN               (ns.gypark.pe.kr 질의 - 성공)
> gypark.pe.kr
Server:         147.46.15.NNN
Address:        147.46.15.NNN#53

Name:   gypark.pe.kr
Address: 147.46.15.HHH               (gypark.pe.kr 질의 - 성공)
> www.gypark.pe.kr
Server:         147.46.15.NNN
Address:        147.46.15.NNN#53

Name:   www.gypark.pe.kr
Address: 147.46.15.HHH               (www.gypark.pe.kr 질의 - 성공)
> plaza1.snu.ac.kr
Server:         147.46.15.NNN
Address:        147.46.15.NNN#53

** server can't find plaza1.snu.ac.kr: REFUSED    (그 외의 도메인에 대한 질의 - 설정에 의해 거부됨)

네임서버설정이 완료되면, 이 네임서버를 내가 등록한 도메인의 네임서버로 지정해 주어야 한다. /개인도메인의네임서버지정 참조





출처 : http://gypark.pe.kr/wiki/%EA%B0%9C%EC%9D%B8%EB%8F%84%EB%A9%94%EC%9D%B8%EB%A7%8C%EB%93%A4%EA%B8%B0/%EB%84%A4%EC%9E%84%EC%84%9C%EB%B2%84%EC%84%A4%EC%A0%95

: