'unix and linux'에 해당되는 글 231건

  1. 2007.08.21 ssh를 이용한 파일 전송 방법
  2. 2007.08.16 시스템 부팅시 프로세스 시작하기
  3. 2007.08.16 리눅스 부팅 순서
  4. 2007.08.02 /proc/net/tcp 보기
  5. 2007.08.02 /proc/net/dev
  6. 2007.06.07 Yum
  7. 2007.06.07 Virtual Box 설치하기
  8. 2007.06.06 페도라 설치
  9. 2006.07.20 Richard Stevens
  10. 2006.01.21 [펌] ssh 포트(22번) 변경하기

ssh를 이용하여 파일을 전송할 수 있는 방법을 소개한다.

 

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch17_:_Secure_Remote_Logins_and_File_Copying

 

SCP: A Secure Alternative to FTP

From a networking perspective, FTP isn't very secure, because usernames, passwords, and data are sent across the network unencrypted. More secure forms such as SFTP (Secure FTP) and SCP (Secure Copy) are available as a part of the OpenSSH package that is normally installed by default on RedHat and Fedora Core. Remember, unlike FTP, SCP doesn't support anonymous downloads like FTP.

The Linux scp command for copying files has a format similar to that of the regular Linux cp command. The first argument is the source file and the second is the destination file. When copying to or from a remote server, SCP logs in to the server to transfer the data and this therefore requires you to supply a remote server name, username, and password to successfully execute the command. The remote filename is therefore preceded by a prefix of the remote username and server name separated by an @ symbol. The remote filename or directory then follows separated by a colon. The format therefore looks like this:

username@servername:filenameusername@servername:directoryname

For example, file /etc/syslog.conf on a server with IP address 192.168.1.100 that needs to be retrieved as user peter would have the format peter@192.168.1.000:/etc/syslog.conf, the entire /etc directory would be peter@192.168.1.000:/etc/.

Note: You can download an easy-to-use Windows SCP client called WinSCP from http://winscp.vse.cz/eng/

Copying Files To The Local Linux Box

If you understand how scp represents remote filenames, you can start copying files fairly easily. For example, to copy file /tmp/software.rpm on the remote machine to the local directory /usr/rpm use the commands

[root@bigboy tmp]# scp root@smallfry:/tmp/software.rpm /usr/rpmroot@smallfry's password:software.rpm                      100% 1011    27.6KB/s   00:00[root@bigboy tmp]#

To copy the file /tmp/software.rpm on the remote machine to the local directory /usr/rpm using TCP port 435, use the commands

[root@bigboy tmp]# scp -P 435 root@smallfry:/tmp/software.rpm /usr/rpmroot@smallfry's password:software.rpm                       100% 1011    27.6KB/s   00:00[root@bigboy tmp]#
 
 
Posted by '김용환'
,

 

1. /etc/rc.local  파일에 추가

2. /etc/rc?.d/S 스크립트 작성

 

'unix and linux' 카테고리의 다른 글

perl에서 slash('/')를 바꾸기(replace)  (0) 2007.08.22
ssh를 이용한 파일 전송 방법  (0) 2007.08.21
리눅스 부팅 순서  (0) 2007.08.16
/proc/net/tcp 보기  (0) 2007.08.02
/proc/net/dev  (0) 2007.08.02
Posted by '김용환'
,

참고 자료.

http://oldfield.wattle.id.au/luv/boot.html

http://ourworld.compuserve.com/homepages/KanjiFlash/BPTour.htm

http://www.linux.com/articles/114107

 

리눅스 부팅순서를 공부해보았다.

 

구글에서 검색할 때는 "boot order"보다는 boot sequence 또는 boot process 가 어울린다.

 

부팅 순서는 크게 다음과 같다.

1. 바이오스

2. MBR

3. LILO(GRUB)

4. 커널

5. init

6. Run level

 

자세히 들어가보자.

 

1. BIOS

내용은 생략..

 

2. MBR

Master boot record

bios는 디스크의 첫번째 512바이트를 읽고 실행한다. 일명 부트 로더를 읽는다.

보통 리눅스에 경우는 /dev/hda 위치하는 부분을 읽는다.

그 이유는 리눅스는 /dev/had1~4까지 bootable이라고 마킹해둔  primary 영역을 찾는다. 그 영역을 찾아 읽고 실행한다.

 

3. LILO(GRUB)

메뉴코드를 읽는다. 보통 /boot/boot.b 에 저장되어 있다.

프롬프트를 먼저 보이고, 해당되는 커널이미지 옵션을 읽는다.

커널이미지와 부트영역과 모듈을 카피하여 실핵한다.

 

다음과 같이 뜰 것이다.

 

Loading linux-2.2.12..........

4. 리눅스 커널 로딩

linux/init/main.c 에 해당 소스가 있다. 여기에 부팅 커널관련된 부팅순서의 내용이 들어가 있다.

 

처음엔 프로세서, 콘솔, 메모리를 초기화한다.

두번째, PCI 버스를 초기화한다.

세번째, 네트웍을 초기화한다.

네번째 프로세스 번호 0 인 커널 IDLE 쓰레드가 실행된다. (/sbin/init )

다섯번째, 드바이스 드라이버를 초기화한다.

         (Generice Parallel port, character device, block device, scsi, ppp, disk)

 

* Root 파일 시스템을 읽기 전에 램디스크 이미지를 읽기도 한다. 해당 내용은 아래를 참조하라 /usr/src/linux-2.4.21-47.EL/Documentation/initrd.txt

 

5. Process 번호 1번 프로그램 실행

 /sbin/init의 연장인데, 굳이 번호를 따지 않아도 되고... run level때문에 분류..

/etc/inittab을 읽어 /etc/rc.d/rc.sysinit을 실행한다. 이 스크립트에는 모듈을 로드하고, 루트 파일 시스템, 마운트 파일시스템, 네트우거 셋팅, 리모트 파일 시스템 마운팅, 폰트, tty, 로긴이후의 배너(/etc/redhat-release), 시계 설정, 커널 파라미터 기타 하드웨어 디바이스 설정 정보가 들어가 있다.

그후, /etc/inittab 파일에서 id:3:initdefault: 줄을 찾아 해당 runlevel을 실행시킨다.

정확하게 말하면 initdefault으로 지정된 값에 해당되는 /etc/rd?.d/S* 스크립트를 실행한다.

 

참고로 run level은 다음과 같다.

  • Linux - The Complete Reference (R.Peterson, Osbourne/McGraw-Hill).

    Run Level

    Generic

    Fedora Core

    Slackware

    Debian

    0HaltHaltHaltHalt
    1Single-user modeSingle-user modeSingle-user modeSingle-user mode
    2Basic multi-user mode (without networking)User definable (Unused)User definable - configured the same as runlevel 3Multi-user mode
    3Full (text based) multi-user modeMulti-user modeMulti-user mode - default Slackware runlevel
    4Not usedNot usedX11 with KDM/GDM/XDM (session managers)Multi-user mode
    5Full (GUI based) multi-user modeFull multi-user mode (with an X-based login screen) - default runlevelUser definable - configured the same as runlevel 3Multi-user mode
    6RebootRebootRebootReboot
  •  

    /etc/init.d/rc가 3일 파라미터로 받아. /etc/rc3.d의 S (Start)스크립트를 실행한다.

    * init 명령어를 이용하여 runlevel이 수정 가능하고, 부팅이후, init 명령어에 의해 K(kill), S(start) 스크립트가 실행된다.

    /etc/init.d/rc.local 파일은 부팅할때 띄우는 데몬이 프로그램을 적는데 사용된다.

    그리고, virtual 콘솔 tty를 셋업한다. (mingtty )

     

    /sbin/login이 실행되어 사용자 이름과 패스워드를 넣는 부분 앞에 /etc/issue 파일의 내용을 화면에 뿌린다.

     

    6. bash shell 실행 (가정)

    로그인후, /etc/motd 파일의 내용을 출력한다. 

    그리고 /etc/passwd파일의 계정정보를 이용하여 쉘을 파악한다.

    /etc/profile을 실행하여 모든 사용자의 시스템 환경 변수를 셋팅한다.

    그리고, 개인 설정는 본인 디렉토리의 .profile .bashrc파일을 읽어서 셋팅된다.

     

     

    'unix and linux' 카테고리의 다른 글

    ssh를 이용한 파일 전송 방법  (0) 2007.08.21
    시스템 부팅시 프로세스 시작하기  (0) 2007.08.16
    /proc/net/tcp 보기  (0) 2007.08.02
    /proc/net/dev  (0) 2007.08.02
    Yum  (0) 2007.06.07
    Posted by '김용환'
    ,

    /proc/net/tcp, udp, raw는 각각 열려있는 tcp, udp, raw 소켓을 알려준다.

     

    참조

    http://linuxdevcenter.com/pub/a/linux/2000/11/16/LinuxAdmin.html

     

      sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode                              
       0: 00000000:0203 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 335 1 c1674320 300 0 0 0
       1: 00000000:0025 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 310 1 c16799a0 300 0 0 0
       2: 00000000:0369 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 316 1 c1677ca0 300 0 0 0
       ...
       ...
      16: 0100007F:0408 0100007F:0017 01 00000000:00000000 00:00000000 00000000  1000       

     

    [dev1:/home1/knight/perl] cat /proc/net/tcp | wc -l
       1331
    [dev1:/home1/knight/perl] cat /proc/net/raw | wc -l
          1
    [dev1:/home1/knight/perl] cat /proc/net/udp | wc -l
          1

     

     

    'unix and linux' 카테고리의 다른 글

    시스템 부팅시 프로세스 시작하기  (0) 2007.08.16
    리눅스 부팅 순서  (0) 2007.08.16
    /proc/net/dev  (0) 2007.08.02
    Yum  (0) 2007.06.07
    Virtual Box 설치하기  (0) 2007.06.07
    Posted by '김용환'
    ,

    /proc/net/dev

    unix and linux 2007. 8. 2. 06:35

    시스템 업무를 하면서 반드시 필요한 정보이다. 현재 네트웍 장비에 대한 정보와 트래픽 정보를 얻어 낼 수 있다.

    모니터링시 네트웍 상황을 얻어올 때, 유용할 수 있다. rrd랑 쓰면 모니터링이 가능할 것이다.

     

    참조자료.

    http://linuxdevcenter.com/pub/a/linux/2000/11/16/LinuxAdmin.html

     

    cat /proc/net/dev 명령어를 치면 다음과 같이 나올 것이다.

    Inter-|   Receive                                                |  Transmit face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed    lo:111787507 281326    0    0    0     0          0         0 111787507 281326    0    0    0     0       0          0  eth0:161543042 916321    0    0    0     0          0     43431 103791415 767750    0    0    0  8664       0          0
    실제 필드의 내용은 다음과 같다.

    bytes

    The total number of bytes of data transmitted or received by the interface.

    packets

    The total number of packets of data transmitted or received by the interface.

    errs

    The total number of transmit or receive errors detected by the device driver.

    drop

    The total number of packets dropped by the device driver.

    fifo

    The number of FIFO buffer errors.

    frame

    The number of packet framing errors.

    colls

    The number of collisions detected on the interface.

    compressed

    The number of compressed packets transmitted or received by the device driver. (This appears to be unused in the 2.2.15 kernel.)

    carrier

    The number of carrier losses detected by the device driver.

    multicast

    The number of multicast frames transmitted or received by the device driver.

    'unix and linux' 카테고리의 다른 글

    리눅스 부팅 순서  (0) 2007.08.16
    /proc/net/tcp 보기  (0) 2007.08.02
    Yum  (0) 2007.06.07
    Virtual Box 설치하기  (0) 2007.06.07
    페도라 설치  (0) 2007.06.06
    Posted by '김용환'
    ,

    Yum

    unix and linux 2007. 6. 7. 21:29

     

     

    세상 겁나 좋아졌다.

    rpm-> 유분투의 모듈 업데이트 시스템 -> yum을 이용한 손쉬운 설치!!! 짱인데.

     

    로그 확인

    cat /var/log/yum.log

     

    설치

    yum install 패키지

     

    변경

    yum update 패키지

     

    설치 여부 확인

    yum search 패키지

     

    설치 리스트 확인

    yum list

     

    http://www.phy.duke.edu/~rgb/General/yum_HOWTO/yum_HOWTO/

     

     

     

    Next Previous Contents


    Yum (Yellow dog Updater, Modified) HOWTO

    Robert G. Brown, rgb at phy.duke.edu

    Jonathan Pickard,fatboy at techno.co.za

    0.3, 2003-09-24
    This is a HOWTO for Yum: the Yellow dog Updater, Modified. Yum is an automatic updater and package installer/remover for rpm-based systems. It automatically computes dependencies and figures out what things should occur in order to safely install, remove, and update rpm packages. Yum also efficiently and easily retrieves information on any package installed or available in a repository to the installer. Yum makes it easier to maintain groups of machines without having to manually update each one using rpm or other tools. Yum can manage package groups, multiple repositories, fallback repositories and more to permit centralized package management performed by just one or two individuals to scale over an entire organization. Note Well! This HOWTO is in a state of total flux during its initial pre-release development. Lots of sections are empty, others are wrong, all is in a state of mediocre organization. Nevertheless, I cherish feedback from anybody on the basis of any snapshot you happen to see.

    1. Introduction

    2. HOWTO Organization

    3. Useful Links:

    4. Preliminaries

    5. Planning a Yum Repository

    6. Setting up an FTP server for yum.

    7. Building Yum

    8. Installing Yum

    9. Yummifying your servers: yum-arch

    10. Setting up the Yum Client

    11. Using the Yum Client

    12. Building RPMs for yum repositories

    13. Security

    14. Etc.

    15. Further Information


    Next Previous Contents

    'unix and linux' 카테고리의 다른 글

    /proc/net/tcp 보기  (0) 2007.08.02
    /proc/net/dev  (0) 2007.08.02
    Virtual Box 설치하기  (0) 2007.06.07
    페도라 설치  (0) 2007.06.06
    Richard Stevens  (0) 2006.07.20
    Posted by '김용환'
    ,

    Virtual Box 설치하기

    VirtualBox 홈페이지에서 윈도우 버젼을 다운받는다.
    http://www.virtualbox.org/wiki/Downloads

     

    VirtualBox_OSX_beta_255c.png
     

     

    VM 생성하기
    - New ( 또는 VM -> New )를 선택하여 New Virtual Machine Wizard!를 실행한다.

    - VM Name 과 OS Type 을 지정한다.

    - Memory에서는 그냥 wizard가 설정해 놓은대로 그냥 Next하라. 288메가가 적당할 것 같다.
     
    - 그다음 부트 하드디스크가 없으면, 새로 이미지를 만든다.

    -  Image Type 선택하고 Image File Name, Image Size 설정한다. 한 여유있게 Fixed 메모리 image로 잡는 것이 좋다. 보통 5~6G로 잡는 것 같다.

    - Next하면 Summary 정보가 보이고 Finish를 눌러 New Virtual Hard Disk Wizard!를 종료한다.

    - 처음의 VirtualBox 화면으로 돌아 와서 해당 vm을 선택하고 Setting 버튼을 선택한다.

    - 비디오 메모리와 베이스 메모리 크기를 결정한다. (나는 base memory를 300M, video memory를 24M로 결정)

    - 설치를 해야 하니까. CD/DVD-ROM을 클릭하여 Mount CD/DVD-ROM Driver 체크 박스를 체크하고 ISO 파일을 지정한다.
     리눅스 설치할 사람은 fedora -live를 이용하라. 아주 설치가 쉽다.

    - 설치 후에 Mount CD/DVD-ROM Driver 체크 박스를 체크오프한다.

     

    VM 실행
    지정된 CD/DVD 혹은 ISO 파일을 읽어서 실행된다.

    Hot Key

    Host Key는 초기설정은 R-Ctrl
    Host Key 변경은 File->Global Settings의 Input Key섹션에서 수정

    OS 간 전환 : Host

    전체 화면 전환 : Host + F

    창 크기 변경 : Host + A

    게스트 화면에 맞춰 자동조정 : Host + G

    마우스 통합 중지하기 : Host + I

    Ctrl+Alt+Del 보내기 : Host + Del

    Ctrl+Alt+Backspace 보내기 : Host + Backspace

    스냅샷 찍기 : Host + S

    게스트 일시 중지 : Host + P

    게스트 재부팅 : Host+ R

    닫기 : Host + Q

     

    기타
    - 파일 공유 , 클립보드 설정이 가능하다. 자세한 것 매뉴얼 참조~

     

     

    'unix and linux' 카테고리의 다른 글

    /proc/net/dev  (0) 2007.08.02
    Yum  (0) 2007.06.07
    페도라 설치  (0) 2007.06.06
    Richard Stevens  (0) 2006.07.20
    [펌] ssh 포트(22번) 변경하기  (0) 2006.01.21
    Posted by '김용환'
    ,

    페도라 설치

    unix and linux 2007. 6. 6. 00:25

    http://www.lug.or.kr/home/bbs/board.php?bo_table=using&wr_id=13

     

    사용자 삽입 이미지

     

     

    설치 방법과 설치 장소가 잘 나와서 링크함.

     

    'unix and linux' 카테고리의 다른 글

    Yum  (0) 2007.06.07
    Virtual Box 설치하기  (0) 2007.06.07
    Richard Stevens  (0) 2006.07.20
    [펌] ssh 포트(22번) 변경하기  (0) 2006.01.21
    unix vi 명령  (0) 2005.02.28
    Posted by '김용환'
    ,

    Richard Stevens

    unix and linux 2006. 7. 20. 07:40
    드디어 Advanced Programming in UNIX Environment를 공부하기 시작했다.
    이 책의 2판은 2005년도에 나왔는데, Stevens가 1999년도에 사망했다는 얘기를 듣고 이 사람에 대해서 좀 알아 보려고, 구굴에서 Richard  Stevens를 검색했더니 그 자신이 쓴 일대기를 볼 수 있었다.

    http://www.kohala.com/start/bio1.html

    http://www.kohala.com/start/


    UNIX와 소프트웨어의 큰 획을 그으신 분이 어떻게 돌아가셨나 구글링을 한 결과, 다음과 같은 글을 발견했다.

    W. Richard Steven noted technology author and teacher died last Wednesday. Stevens was best known for his UNIX Network Programing series and and TCP/IP Illustrated book. The family has asked that in lieu of flowers, be made in Richard's name to Habitat for Humanity, 2950 E. 22nd Street, Tucson, AZ 85713. He is survived by his wife and three children. The cause of death was not reported.
    (http://www.hackcanada.com/hackcanada/media/hnn090899.html)

    Born: 1951
    Birthplace: Luanshya, Northern Rhodesia
    Died: 1-Sep-1999
    Location of death: Tucson, AZ
    Cause of death: unspecified
    Gender: Male
    Ethnicity: White
    Occupation: Author
    Nationality: United States

    (http://www.nndb.com/people/948/000023879/)

    그의 죽음은 불명확한 돌연사인듯 하다. 너무 열심히 산 까닭일런지는 모르겠다. 특이한 점은 그가 해비타트와 연관이 있다는 점이 그가 어떻게 인생을 살았는지 알아 보는 것도 괜찮을 것 같다라는 생각이 들었다. 48살에 운명을 달리했지만, 그 사람이 아니었다면, IT의 역사가 거꾸로 갔을 지도 모르겠다라는 생각이 든다.

    'unix and linux' 카테고리의 다른 글

    Yum  (0) 2007.06.07
    Virtual Box 설치하기  (0) 2007.06.07
    페도라 설치  (0) 2007.06.06
    [펌] ssh 포트(22번) 변경하기  (0) 2006.01.21
    unix vi 명령  (0) 2005.02.28
    Posted by '김용환'
    ,
    ssh 포트(22번) 변경하기
    글 쓴 이  : 굼벵이 관리자 등록일 : 2005년 11월 30일 오후 05:10
    카테고리 : Linux 관리하기 조회수 : 80      만족률 :
    ssh 포트(22번)를 다른 포트로 변경해 보자.

    22번 포트로 접근해 무작위로 패스워드 대입하는 로그가 기록 되었으나, 귀차니즘으로 인해 지금껏 방치하다가 질문이 올라온 길에 포트 변경을 해 봅니다..
    아래를 참조해 설정해 보세요..
    (존칭 생략.. ^^)

    ssh_config 파일은 클라이언트 툴의 접근에 대한 설정을 하는 파일이고..(즉 사용자를 위한 파일)
    sshd_config 파일은 ssh 데몬 설정을 위한 설정 파일이다.(즉 서버용이라고 보면 된다.)

    우선 원격에서 작업하는 경우 telnet 으로 접근해 작업을 하도록 하자.
    잘못된 설정이나 에러로 원격 접속이 되지 않는 낭패를 볼수 있으니..
    텔넷을 사용하지 않고 있다면 http://www.chtla.com/stories.php?story=04/01/06/1090396 이글을 참조해 텔넷을 열어주면 된다.
    (오랫된 글이지만, 텔넷 열어주는데는 큰 무리가 없을듯..)

    우선 포트번호 정하자..
    여기서는 2202번 포트로 할것이다.
    포트 번호는 맘대로 정해도 되나, 다른 데몬에서 사용하지 않는 포트 번호를 사용해야 한다.
    (1024번 위 포트를 지정해야 한다.)

    # vi /etc/ssh/ssh_config
    Port 22002 <== 포트 변경

    # vi /etc/ssh/sshd_config
    Port 22002 <== 포트 변경

    ListenAddress xx.xxx.xx.xx <= 0.0.0.0를 서버 아이피로 변경

    설정이 이걸로 끝났다..
    후후.. 무지 간단하다고 욕하지 않을지.. ^^;;

    이제 sshd를 재실행하자..
    standalone 이면
    # /etc/init.d/sshd restart

    init 방식이면
    # /etc/init.d/xinetd restart

    이제 포트가 열려 있는지 확인해 보자..
    # netstat -na|grep :22002
    tcp 0 0 xx.xxx.xx.xx:22002 0.0.0.0:* LISTEN

    방화벽(iptables)가 설정되어 있다면 열어준 해당 포트를 열어 주어야 한다.
    (tcp, udp 둘 다 22002를 열어 준다.)

    다 끝났다.. (너무 간단하네요..)
    외부에서 접근해 보자.

    > ssh test@xx.xxx.xx.xx -p 22002
    Password:
    Last login: Wed Nov 30 16:34:26 2005 from xx.xxx.xx.xx
    Good Lucky...
    >

    정상적으로 접근하는 것을 볼수 있다..
    만일

    sshd[241]:error:Bind to port 22002 on : failed: address already in use

    재실행후 이런 에러가 보인다면 /etc/ssh/sshd_config 파일에서 ListenAddress 를 지정해 주지 않아서 그렇다.
    이곳에 해당 서버 아이피를 적어주면 해당 에러는 해결 될것이다.
    기본 포트가 아니다 보니 해당 서버 아이피를 적어 주어야 제대로 작동하기 때문이다.
    출처 : 초심 http://www.chtla.com/stories.php?story=05/11/30/8217436

    'unix and linux' 카테고리의 다른 글

    Yum  (0) 2007.06.07
    Virtual Box 설치하기  (0) 2007.06.07
    페도라 설치  (0) 2007.06.06
    Richard Stevens  (0) 2006.07.20
    unix vi 명령  (0) 2005.02.28
    Posted by '김용환'
    ,