2010. 1. 3. 04:47

0. 리눅스 전반

리눅스 프로그래머를 위한 가이드

http://www.coffeenix.net/doc/lpg/lpg_0.html


The GNU C Library 

원본 : http://www.gnu.org/software/libc/manual/html_mono/libc.html

번역 : http://database.sarang.net/study/glibc/0.htm

문서 : http://database.sarang.net/study/c/glibc/Glibc.hwp

 

1. Network programming

Davin's collection of unix programming links

http://www.cse.buffalo.edu/%7Emilun/unix.programming.html

 

W. Richard Stevens' Home Page

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

 

 

2. PHP programming

PHP 매뉴얼

http://www.php.net/manual/kr/

 

PHP Conference Material Site

http://conf.php.net/

 

 

3. Bash Shell

Bash Reference Manual

http://www.gnu.org/software/bash/manual/bashref.html

 

[KLDP] 고급 배쉬 스크립트 가이드

http://kldp.org/HOWTO/html/Adv-Bash-Scr-HOWTO/

 

developerWorks Korea : 예제로 배우는 배쉬 프로그래맹 : Part1

http://www-903.ibm.com/developerworks/kr/linux/library/bash.html?dwzone=linux

 

developerWorks Korea : 예제로 배우는 배쉬 프로그래맹 : Part2

http://www-903.ibm.com/developerworks/kr/linux/library/bash2.html?dwzone=linux

 

developerWorks Korea : 예제로 배우는 배쉬 프로그래맹 : Part3

http://www-903.ibm.com/developerworks/kr/linux/library/bash3.html?dwzone=linux

 

 

4. SED

sed, the stream editor

http://www.student.northpark.edu/pemente/sed/

 

[KR] SED(Streaming EDitor) menual

http://database.sarang.net/study/awk/sed_manual-linuxnet.html

 

 

5. awk

[KR] awk

http://database.sarang.net/study/awk/awk_manual-linuxnet.html

 

*오픈 소스 보안 소프트웨어*
▷ SourceForge
http://www.sourceforge.com
▷ Freshmeat
http://www.Freshmeat.net
▷ Packetstorm
http://packetstormsecurity.org
▷ SecurityFocus
http://www.securityfocus.com
▷ RPMFind
http://www.rpmfind.net
▷ LinuxLinks
http://www.linuxlinks.com
▷ Tucows
http://www.tucows.com
▷ Startplaza
http://www.startplaza.nu
▷ AtStacke
http://www.atstake.com

 

'Linux' 카테고리의 다른 글

[CentOS]Consol Network 설정  (0) 2010.05.26
Job 스케줄링  (0) 2010.05.18
솔라리스 디렉토리  (0) 2010.05.14
리눅스 배포판 확인  (0) 2009.12.03
/dev/null 2>&1  (0) 2009.12.03
Posted by devanix
2009. 12. 20. 15:09
~/.vimrc.html
  1 """"""""""""""""""""""""""""""""""
  2 " personal Vim initializations   "
  3 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  4 "+-----------------------------+                                    "
  5 "| General                     |\-----------------------------------"
  6 "+_____________________________+ | Comment                          "
  7 "\______________________________\|=================================="
  8 set nocompatible                "| 오리지널 vi와 호환성 제거        "
  9 set noexrc                      "| don't use local version of .(g)vimrc, .exerc
 10 set fileformats=unix,dos,mac    "|    
 11 set background=dark             "| 배경색을 어두운 색으로 설정      "
 12 set history=1000                "| vi 편집기록을 1000까지 기억      "
 13 set nobackup                    "| backup 파일 생성 안함            "
 14 filetype on                     "| 파일의 종류를 자동으로 인식      "
 15 filetype plugin on              "|                                  "
 16 filetype plugin indent on       "|                                  "
 17 syntax on                       "| syntax highlighting on           "
 18 "+_______________________________|=================================="
 19 "\_______________________________\
 20 "
 21 "
 22 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 23 "+-----------------------------+                                    "
 24 "| Vim UI                      |\-----------------------------------"
 25 "+_____________________________+ | Comment                          "
 26 "\______________________________\|=================================="
 27 set title                       "| 타이틀바에 현재 편집중인 파일 표시
 28 set lazyredraw                  "| MACRO 사용중에 화면을 다시 그리지 않음
 29 set cursorline                  "| 현재 라인 강조                   "
 30 "set cursorcolumn               "| 현재 컬럼 강조                   "
 31 set laststatus=2                "| 상태 라인 항상 표시              "
 32 set incsearch                   "| 검색(/,?)시 구문 강조            "
 33 set hlsearch                    "| 검색어 강조                      "
 34 "set list                       "| <TAB>, <CR> 출력 서식 표시       "
 35 set ruler                       "| 커서의 위치 항상 표시            "
 36 set number                      "| 줄번호 표시                      "
 37 set showmode                    "| 모드 변환시 화면에 표시          "
 38 set showcmd                     "| 입력되는 명령 표시               "
 39 set showmatch                   "| (), {} 일치하는 괄호의 짝을 보여줌
 40 set mps+=<:>                    "| 괄호짝 찾기 기능에 사용자 괄호 종류 추가
 41 "\_______________________________\
 42 if !has("gui_running")          "|
 43     set t_Co=256                "|
 44 endif                           "|
 45 colorscheme wombat256           "|
 46 "+_______________________________|=================================="
 47 "\_______________________________\
 48 "For detail cursorline color setting
 49 ":hi CursorLine    cterm=none ctermbg=darkred ctermfg=white guibg=darkred guifg=white
 50 "
 51 "
 52 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 53 "+-----------------------------+                                    "
 54 "| Text Formatting/Layout      |\-----------------------------------"
 55 "+_____________________________+ | Comment                          "
 56 "\______________________________\|=================================="
 57 set cindent                     "| C스타일의 들여쓰기               "
 58 set autoindent                  "| 자동들여쓰기                     "
 59 set smartindent                 "| 좀더 지능적인 들여쓰기           "
 60 "set expandtab                  "| 탭을 입력하면 공백문자로 변환    "
 61 set paste                       "| 붙여넣기시 자동들여쓰기 하지 않음"
 62 set ignorecase                  "| 검색시 대소문자 구별 하지 않음   "
 63 set nowrap                      "| 자동 줄바꿈 안함                 "
 64 set shiftwidth=4                "| >> , << 사용시 들여쓰기 간격     "
 65 set softtabstop=4               "| <TAB>키를 눌렀을때 표시되는 간격 "
 66 set tabstop=8                   "| '\t' 문자를 몇칸으로 보일지 결정 "
 67 "+_______________________________|=================================="
 68 "\_______________________________\
 69 "
 70 "
 71 """"""""""""""""""""""""""""""""""
 72 "+-----------------------------+ "
 73 "| Key Mapping                 |\"
 74 "+_____________________________+ |
 75 "\______________________________\|
 76 map <F2> $v]}zf
 77 map <F3> zo
 78 map <C-F11> :cw<CR>
 79 "
 80 " CTRL-A is Select all
 81 noremap <C-A> ggVG
 82 "================================"
 83 " 파일 버퍼 간 이동
 84 "================================"
 85 map <C-h>   :bp<CR>
 86 map <C-l>   :bn<CR>
 87 map <C-k>   :bf<CR>
 88 map <C-j>   :bl<CR>
 89 map ,1 :b!1<CR>
 90 map ,2 :b!2<CR>
 91 map ,3 :b!3<CR>
 92 map ,4 :b!4<CR>
 93 map ,5 :b!5<CR>
 94 map ,6 :b!6<CR>
 95 map ,7 :b!7<CR>
 96 map ,8 :b!8<CR>
 97 map ,9 :b!9<CR>
 98 map ,0 :b!10<CR>
 99 map ,w :bwipeout<CR>
100 "+_______________________________|
101 "\_______________________________\
102 
103 
104 
105 "+-----------------------------+  
106 "| Plugin                      |\ 
107 "+_____________________________+ |
108 "\______________________________\|
109 "| 
110 """"""""""""""""""""""""""""""""""
111 " [ http://www.vim.org/scripts/script.php?script_id=159 ]
112 "+{ Minibufexplorer 
113 """"""""""""""""""""""""""""""""""
114 map <F8> :TMiniBufExplorer<CR>
115 let g:miniBufExplSplitBelow=0   "| 미니버퍼위치 0=위, 1=아래
116 let g:miniBufExplMaxSize=1
117 let g:miniBufExplSplitToEdge=1
118 "let g:miniBufExplMapWindowNavVim=1 
119 "let g:miniBufExplMapWindowNavArrows=1 
120 "let g:miniBufExplMapCTabSwitchBufs=1
121 "let g:miniBufExplModSelTarget=1 
122 " }
123 "
124 """"""""""""""""""""""""""""""""""
125 " [ http://www.vim.org/scripts/script.php?script_id=273 ]
126 "+{ TagList
127 """"""""""""""""""""""""""""""""""
128 map <F5> :TlistToggle<CR>
129 let Tlist_Ctags_Cmd='/usr/bin/ctags'
130 let Tlist_Inc_Winwidth=0
131 let Tlist_WinWidth = 20
132 let Tlist_Exit_OnlyWindow=1
133 let Tlist_Use_Right_Window=1      "분할 창을 오른쪽에 배치
134 " }
135 
136 
137 
138 """"""""""""""""""""""""""""""""""
139 " CTAGS 설정
140 """"""""""""""""""""""""""""""""""
141 set tags=./tags,/usr/include/tags
142 set tags+=/usr/src/linux-source/tags
143 
144 if version >= 500
145 func! Sts()
146         let st = expand("<cword>")
147         exe "sts ".st
148 endfunc
149 nmap ,st :call Sts()<cr>
150 
151 func! Ts()
152         let st = expand("<cword>")
153         exe "ts ".st
154 endfunc
155 nmap ,ts :call Ts()<cr>
156 
157 func! Tj()
158         let st = expand("<cword>")
159         exe "tj ".st
160 endfunc
161 nmap ,tj :call Tj()<cr>
162 
163 endif
164 
165 
166 "+-----------------------------+  
167 "| Manpage                     |\ 
168 "+_____________________________+ |
169 "\______________________________\|
170 func! Man()
171         let sm = expand("<cword>")
172         exe "!man -S 2:3:4:5:6:7:8:9:tcl:n:l:p:o:1 ".sm
173 endfunc
174 "nmap ,ma :call Man()<cr><cr>
175 map <S-k> :call Man()<cr><cr>
176 "+_____________________________+ |
177 "\_______________________________\~
178 "

'Essential Tools > VIM - Vi IMproved' 카테고리의 다른 글

Vim 편집기로 스크립트 작성하기  (0) 2011.09.23
[VIM Plugin] T-Commant  (0) 2011.09.22
[VIM Plugin] snipMate  (0) 2011.09.22
[VIM] 단축키 정리  (0) 2011.06.27
Posted by devanix
2009. 12. 19. 15:48
NAME
     system - 쉘 명령어 실행기

SYNOPSIS
     #include <stdlib.h>
     int system(const char *command);

DESCRIPTION
     system() 함수는 /bin/sh -c command를 호출 하여 command에 지정된 명령어를 실행하고,
     명령어가 끝난후 반환한다. 명령어가 실행동안, SIGCHLD는 블럭되며, SIGINT, SIGQUIT는
     무시된다.
system() 함수는 기본적으로 fork()와 execve()의 조합응용이다.

RETURN VALUE
     만약 /bin/sh를 실행시키기 위한 execve()의 호출이 실패했다면 127이 리턴되며, 다른 에러가
     있다면 -1, 그렇지 않다면 명령어의 리턴코드가 반환된다.
command값이 NULL이고,
    
system()이 shell을 이용할 수 있다면 0이 아닌 값을 그렇지 않다면 0을 반환한다.
     system
()은 다른 wait()상태의 다른 자식에게 영향을 주지 않는다.

EXAMPLE

   #include <stdio.h>
   #include <stdlib.h>
   #include <sys/wait.h>

   int main(int argc, char *argv[])
   {
      int ret;
      ret = system("ls -al");
      printf("Exit Status : [%d]\n", WEXITSTATUS(ret) );
      return 0;
   }



참조:
JOINC WIKI - SYSTEM(3)

'API 및 라이브러리 > C 라이브러리 함수' 카테고리의 다른 글

strdup(3)  (0) 2010.09.14
strstr(3)  (1) 2010.09.11
getusershell(3)  (0) 2009.12.19
syslog, openlog(3)  (0) 2009.12.18
getutent(3)  (0) 2009.12.17
Posted by devanix
2009. 12. 19. 09:31

NAME
       getusershell, setusershell, endusershell - get permitted user shells

SYNOPSIS
       #include <unistd.h>
       char *getusershell(void);
       void   setusershell(void);
       void   endusershell(void);


DESCRIPTION

      The getusershell()
함수는 /etc/shells 내용을 한라인씩 읽어 리턴해준다.
      로그인시 /etc/passwd 파일에 적혀있는 사용자 쉘과 이 내용을 비교하여 적절한 사용자
      쉘을 셋팅해 준다.
/etc/shells 파일이 없거나 읽을수 없는 상태라면 시스템에 기본적으로
      제공하는 /bin/sh, /bin/csh 와같은 쉘을 리스트해 준다.


       The setusershell()  function rewinds /etc/shells.
       The endusershell() function closes /etc/shells.

RETURN VALUE
       The getusershell() 는 파일에 끝을 만나면 NULL을 리턴한다.

FILES
       /etc/shells

EXAMPLE
   setusershell ();
  while ((vshell = getusershell () ) != NULL &&
              pw && strcmp(pw->pw_shell, vshell) ) ;
 
  endusershell ();

pw 구조체에 저장된 /etc/passwd 파일의 쉘(pw->pw_shell)과  getusershell()의 리턴값을 루프를 돌면서 비교하고 있당.



'API 및 라이브러리 > C 라이브러리 함수' 카테고리의 다른 글

strstr(3)  (1) 2010.09.11
system(3)  (0) 2009.12.19
syslog, openlog(3)  (0) 2009.12.18
getutent(3)  (0) 2009.12.17
ttyname(3)  (0) 2009.04.04
Posted by devanix
2009. 12. 18. 08:31

SYSNOPSIS

void openlog(const char *ident, int option, int facility);

void syslog(int priority, const char *format, ...);

void closelog(void);

int setlogmask(int maskpri);

   

syslog

syslog 함수는 syslogd 데몬에게 메시지를 전송한다.

syslogd 데몬은 받은 메시지를 파일에다 기록하거나, 화면에다 출력하거나, 다른 호스트에 있는 또다른

syslogd 데몬에게 포워딩한다.

   

첫번째 priority 인자는 로그 메시지에 중요성을 결정하며, 우선순위는 가장 순위가 높은 LOG_EMERG에서

가장 순위가 낮은 LOG_DEBUG 이르는 계층적인 구조를 가지고 있다.

매크로

실제값

설명

LOG_EMERG

0

A panic condition. This is normally broadcast to all users.

LOG_ALERT

1

A condition that should be corrected immediately, such as a corrupted system database.

LOG_CRIT

2

Critical conditions, e.g., hard device errors.

LOG_ERR

3

Errors.

LOG_WARNING

4

Warning messages.

LOG_NOTICE

5

Conditions that are not error conditions, but should possibly be handled specially.

LOG_INFO

6

Informational messages.

LOG_DEBUG

7

Messages that contain information normally of use only when debugging a program.

두번째와 세번째는 printf 함수와 같은 포맷 문자열과 불확정 매개변수(?)이다.

   

   

openlog

openlog syslog 함수를 호출하기전에 호출하는 사전작업이라고 생각됩니다.

일반적으로 application에서 syslog 호출하기 위해서는 첫번째 하는일이  Unixdomain datagram socket

syslogd daemon 통해 만들어진  /var/run/log 소켓에connect하는 함수를 호출합니다.

하지만 openlog 함수는 이러한 소켓을 만들지 않습니다. openlog함수는 syslog 함수가 호출 되기 전에 호출할 있으며

   void openlog(const char *ident, int options, int facility);


openlog
혼자 동작되는 것이 아니며 syslog 호출을 위해서  여러가지 option  setting하는 합니다.

위에서 설명된 것을 기초로 openlog함수는 동작하며 openlog 호출한다고 해서 자동적으로  syslog 함수가 호출되는 것은 아닙니다.

로그 파일에다가 뭔가 특별한 처리를 해야 하는 경우에는, openlog 함수를 이용해야 한다.

 

첫번째 ident 인자는 모든 로그 문자열 앞에 붙을 ID 문자열이다. 보통은 프로그램 이름을 명기한다.

두번째 option 인자는 로그 방식에 대한 플래그이다. (LOG_CONS, LOG_NDELAY, LOG_PID .. 맨페이지 참조)

세번째 facility 인자는 어떤 프로그램이 로그를 생성했는가에 대한 플래그이다.

일반적으로 LOG_USER 또는 LOG_LOCAL0 ~ LOG_LOCAL7 사용하면 된다.

setlogmask 함수를 이용해, 어느 수준까지의 로그를 실제로 로그할 것인지를 정해줄 있다. LOG_UPTO 매크로를 이용하면 간단하다.

2 예제

2.1 로그에다 쓰기

     

#include <stdio.h>

#include <string.h>

#include <stdarg.h>

#include <syslog.h>

#include <unistd.h>

#include <sys/types.h>


int main(int argc, char *argv[])

{

    char *progname;

    if ((progname = strrchr(argv[0], '/')) == NULL)

        progname++;

    else progname = argv[0];
// NOTICE 레벨까지의 메시지만을 기록한다.
    setlogmask (LOG_UPTO (LOG_NOTICE));

 // 로그 메시지 셋팅.
    openlog (progname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);

// 메시지를 기록
    syslog (LOG_NOTICE, "Program started by User %d", getuid ());

// NOTICE까지 기록하기로 설정했으니, 아래의 메시지는 기록되지 않는다.
    syslog (LOG_INFO, "A tree falls in a forest");

    closelog ();

    return 0;
}

   

2.2 로그 읽어들이기

위의 쓰기 예제에서 생성한 로그는 보통 /var/log/messages /var/log/syslog파일에 기록된다.



참조:
JOINC WIKI - SYSLOG 사용하기(1).
JOINC WIKI - SYSLOG 사용하기(2).

 

'API 및 라이브러리 > C 라이브러리 함수' 카테고리의 다른 글

system(3)  (0) 2009.12.19
getusershell(3)  (0) 2009.12.19
getutent(3)  (0) 2009.12.17
ttyname(3)  (0) 2009.04.04
memcpy(3)  (0) 2009.04.03
Posted by devanix
2009. 12. 17. 06:10

getutent - utmp파일을 이용해서 로그인

사용법

#include <utmp.h>

   

struct utmp *getutent(void);

struct utmp *getutid(const struct utmp *id);

struct utmp *getutline(const struct utmp *line);

struct utmp *pututline(const struct utmp *utmp);

void setutent(void);

void endutent(void);

int utmpname(const char *file);

   

   

설명

utmp는 커널에서 관리하는 로그인테이블 관리 시스템으로 현재 로그인된 유저와 언제 로그인했는지, 어떤 터미널(tty)를 사용하고 있는지, 접속한 호스트의 IP등의 정보를 남긴다. 로그아웃 했다면 언제 했는지에 대한 정보도 저장한다.

#include <utmp.h>

   

struct utmp *getutent(void);

   

   

getutent(), getutid(), getutline(), pututline()를 이용하면 utmp 구조체의 포인터를 리턴한다. utmp 구조체는 다음과 같은 멤버변수를 가진다.

struct utmp

{

short ut_type; /* type of login */

pid_t ut_pid; /* pid of login process */

char ut_line[UT_LINESIZE]; /* device name of tty - "/dev/" */

char ut_id[4]; /* init id or abbrev. ttyname */

char ut_user[UT_NAMESIZE]; /* user name */

char ut_host[UT_HOSTSIZE]; /* hostname for remote login */

struct exit_status ut_exit; /* The exit status of a

process marked as DEAD_PROCESS. *

long ut_session; /* session ID, used for

   

struct timeval ut_tv; /* time entry was made. */

int32_t ut_addr_v6[4]; /* IP address of remote host. */

char pad[20]; /* Reserved for future use. */

};

   

   

getutent()는 utmp 파일로 부터 다음 엔트리의 값을 읽어온다. 만약 utmp 파일이 열려있지 않다면 open한다. 더이상 읽을 엔트리가 없다면 NULL을 리턴한다.

getutid()는 utmp의 현재 ut_id 와 id_ut_id 가 일치하는 것을 현재 포인트부터 엔트리를 돌면서 찾아낸다. 엔트리의 끝까지 이동했을때까지 일치하는 정보가 없다면 NULL을 리턴한다.

getutline()는 ut_line 와 line->ut_line 문자열이 일치하는 것을 찾아서 리턴힌다. 일치하는 엔트리가 없다면 NULL을 리턴한다. ut_type 이 LOGIN_PROCESS인 것에 대해서 검사한다.

setutent()를 사용하면 utmp 파일의 처음으로 이동한다.

endutent() 최근 열린 utmp 파일을 닫는다.

반환값

utmp구조체에 대한 포인터를 돌려준다. 더이상 데이터가 없다면 NULL을 되돌려준다.

에러

에러가 발생하면 (struct utmp *)0 을 되돌려준다.

   

   

참조

http://www.joinc.co.kr/modules/moniwiki/wiki.php/man/3/getutent

'API 및 라이브러리 > C 라이브러리 함수' 카테고리의 다른 글

getusershell(3)  (0) 2009.12.19
syslog, openlog(3)  (0) 2009.12.18
ttyname(3)  (0) 2009.04.04
memcpy(3)  (0) 2009.04.03
isatty(3)  (0) 2009.04.02
Posted by devanix
2009. 12. 14. 13:05

/**** 기본설정 *****************************************************/
* 시스템-> 언어 (한국어/한국어/똑같이 유지/ibus) 한국어 언어팩 설치.
* 시스템-> 업데이트 관리자 (설정->업데이트-> 업데이트 확인 체크해제)
* 시스템-> 하드웨어 드라이버 (그래픽 가속 [권장] 활성화) 
******************************************************************/

/**** 인스톨 *******************************************************/
* ibus 특수문자 입력 가능패키지 설치(설치후 재부팅)

* bum(Boot-Up Manager) - Graphical runlevel editor
*시냅틱 관리자-> "tvtime" 설치 (NTSC -> CABLE)
tvtime 설치후 메뉴 한글폰트 출력하기
sudo rm /usr/share/tvtime/tvtimeSansBold.ttf
sudo ln -s /usr/share/fonts/truetype/unfonts/UnDotum.ttf  \
/usr/share/tvtime/tvtimeSansBold.ttf

******************************************************************/

/**** 언인스톨 *****************************************************/
* 시냅틱 패키지 관리자->게임-> "gnome-games-common" (완전 삭제)
* 시탭틱 패키지 관리자-> "scim" (완전 삭제)
*******************************************************************/


/**** 개발자 설정 ****************************************************/
$ sudo apt-get install vim
$ sudo apt-get install build-essential
$ sudo apt-get install manpages-dev
$ sudo apt-get install manpages-posix manpages-posix-dev
$ sudo apt-get install ctags
* autoconf/ automake/ autotools -dev/ m4
*******************************************************************/   


나머진 생각나면 계속 업뎃…..
Posted by devanix
2009. 12. 14. 05:21

설치

OpenSSH 클라이언트와 서버 프로그램의 설치는 간단합니다. 우분투 시스템에 OpenSSH 클라이언트 프로그램을 설치하려면, 다음의 명령을 터미널 프롬프트에서 사용합니다:

sudo apt-get install openssh-client

OpenSSH 서버 프로그램과 관련되는 지원 파일을 설치하려면, 다음의 명령을 터미널 프롬프트에서 사용합니다:

sudo apt-get install openssh-server

The openssh-server package can also be selected to install during the Server Edition installation process.

설정

여러분은 OpenSSH 서버 프로그램, sshd, 의 기본 동작을 /etc/ssh/sshd_config 파일을 편집하는 것으로 설정할 수 있습니다.

man sshd_config

*설정 파일을 편집하기 전에, 원래의 파일을 복사본을 만들고 쓰기에서 그것을 보호해야만 합니다.

그래서 원래의 설정을 참고로 그리고 필요한 경우 재사용할 수 있습니다.

/etc/ssh/sshd_config 파일을 복사하고 쓰기에서 그것을 보호하려면, 터미널 프롬프트에서 다음의 명령을 입력.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original

sudo chmod a-w /etc/ssh/sshd_config.original

 

다음은 여러분이 변경할 수 있는 설정 지시자의 예 입니다:

  • 여러분의 OpenSSH가 기본 설정된 TCP 포트 22 대신에 TCP 포트 2222를 사용하게 하려면, Port 지시자를 변경 :
    • Port 2222
  • sshd 가 공개 키 기반의 로그인 신뢰서를 허용하게 하려면, /etc/ssh/sshd_config 파일에서 간단히 이 줄을 더하거나 변경:
    • PubkeyAuthentication yes
    • In the /etc/ssh/sshd_config file, or if already present, ensure the line is not commented out.
  • 여러분의 OpenSSH 서버에서 로그인하기 전에 보여줄 배너로 /etc/issue.net 파일의 내용을 표시하게 만드려면, 간단히 이 줄을 더하거나 변경:
    • Banner /etc/issue.net
    • In the /etc/ssh/sshd_config file.

 

/etc/ssh/sshd_config 파일에 변경을 만든 후에, 그 파일을 저장하고, 변경의 효과를 가지려면

다음 명령을 터미널 프롬프트에서 사용하여 sshd 서버 프로그램을 재시작 합니다:

sudo /etc/init.d/ssh restart

 

sshd 를 위한 많은 다른 설정 지시자는 여러분의 필요에 맞게 그 서버 프로그램의 동작을 변경하는 것을 위하여 사용가능 합니다. 그러나, 만약 여러분이 서버를 접근할 수 있는 오직 한 가지 방법이 ssh 이고, /etc/ssh/sshd_config 파일을 통해 sshd 를 설정하는데 실수를 하였다면, 서버를 재시작할 때 잠겨지거나 sshd 서버가 부정확한 설정 지시자 때문에 시작하는 것이 거부될 수 있음을 조언 합니다. 그러므로 원격 서버 상의 이 파일을 편집할 때는 정말로 조심스럽게 하시기 바랍니다.

 

SSH Keys

SSH keys allow authentication between two hosts without the need of a password. SSH key authentication uses two keys a private key and a public key.

To generate the keys, from a terminal prompt enter:

ssh-keygen -t dsa

 

This will generate the keys using a DSA authentication identity of the user. During the process you will be prompted for a password. Simply hit Enter when prompted to create the key.

By default the public key is saved in the file ~/.ssh/id_dsa.pub, while ~/.ssh/id_dsa is the private key. Now copy the id_dsa.pub file to the remote host and append it to ~/.ssh/authorized_keys by entering:

ssh-copy-id username@remotehost

 

Finally, double check the permissions on the authorized_keys file, only the authenticated user should have read and write permissions. If the permissions are not correct change them by:

chmod 644 .ssh/authorized_keys

 

You should now be able to SSH to the host without being prompted for a password.

 

참조
우분투 서버 가이드 - OpenSSH 서버

OpenSSH 웹사이트

진보한 OpenSSH 위키 페이지

SSH-KLDP

 

Posted by devanix