SCP는 또 뭐야~?


일단 wiki 에는..(http://en.wikipedia.org/wiki/Secure_copy)


Secure copy or SCP is a means of securely transferring computer files between a local host and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol.

The term SCP can refer to one of two related things, the SCP protocol or the SCP program.


라고 한다.

파일 전송 개념인갑다.



Definition - What does Secure Copy mean?

Secure copy (SCP) is a file transfer protocol, which helps in transferring computer files securely from a local host to a remote host. It works on the Secure Shell (SSH) protocol technique. 

The term secure copy refers to either the SCP protocol or the SCP program. The SCP protocol is a file transfer network protocol, which supports encryption and authentication features. It is based on the Berkeley Software Distribution (BSD) Remote Copy Protocol (RCP), which runs on port 22 using the SSH Protocol.



Techopedia explains Secure Copy

SCP can be called more of a combination of RCP and SSH than a protocol because the file transfer is performed using RCP and authentication and encryption are provided by the SSH Protocol. SCP maintains the confidentiality of the data being transferred and protects the authenticity by blocking packet sniffers from extracting valuable information from the data packets.

The SSH protocol supports the inclusion of basic attributes like permissions and timestamps for the file to be uploaded. The inclusion of a date/timestamp attribute is not supported in common FTP. The client provides the server with all the files to be uploaded. A request for downloading the files and directories is sent by the client. The server provides the client with all the subdirectories and files available for download. Since the download is controlled by the server, there are chances of security risks when connected to a malicious server. 

On the other hand, the SCP program implements the SCP protocol as a client or a service daemon. The SCP server program and the SCP client are one and the same. A typical example of an SCP program is the command line SCP program available with most of the SSH implementations.



rsync 가 뭘까? 알씽크..


웬지 맘에 드는 알 ㅋㅋ


wiki 에 의하면 (http://en.wikipedia.org/wiki/Rsync)


rsync is a utility software and network protocol for Unix-like systems (with a port to Microsoft Windows) that synchronizes files and directories from one location to another while minimizing data transfer by using delta encoding when appropriate. It also has the option to provide encrypted transfer by use of SSH. SSL encrypted transfer can be done via Stunnel wrapping. Quoting the official website: "rsync is a file transfer program for Unix systems. rsync uses the 'rsync algorithm' which provides a very fast method for bringing remote files into sync."[3] A feature of rsync not found in most similar programs/protocols[citation needed] is that the mirroring takes place with only one transmission in each direction, eliminating the message latency overhead inherent in transmitting a large number of small messages.[4] rsync can copy or display directory contents and copy files, optionally using compression and recursion.

For secure transfer, rsync can use SSH to encrypt data during the transfer using the "-e ssh" option. From the man page: "For remote transfers, a modern rsync uses ssh for its communications, but it may have been configured to use a different remote shell by default, such as rsh or remsh."

In daemon mode, rsync listens by default on TCP port 873, serving files in the native rsync protocol (using the "rsync://" syntax). You can also implicitly start it through a remote shell such as RSH or SSH[5] (using the "user@host:[:]" syntax. The "::" mode is not well described and not easy to use). Of course, in both cases you need an rsync client executable installed on the local machine; in the latter case, the client executable acts as a server.

Released under the GNU General Public License version 3, rsync is free software and is widely used.[6][7][8][9]


라고 한다.. 먼말인지 알겠음??


나는머.. 그래서 한글 찾아봄..

http://dev.jpblog.co.kr/21

http://www.joinc.co.kr/modules/moniwiki/wiki.php/Site/Tip/Rsync


위 두곳이 정리가 잘 되어 있음.. 정말 잘되어있다.


끝.

ln(Link)                                                                                                               

i-node는 파일의 생성과 동시에 임의로 부여되며,  번호확인은 ls -i 로 확인할 수 있다. 또한  리눅스에서는 모든 디 

  바이스나 디렉토리를 파일개념으로 인식하기 때문에 전부 inode를 부여받는다.  만약 inode가 같은 파일이 있다면   

  파일 이름이 다르더라도 이 파일은 같은 파일이 된다.

* 하나의 특정한 파일을 다른 파일 이름으로도 사용하고자 할 때 사용                                                      

* cp명령은 원본 파일의 내용을 바꾸어도 복사된 파일의 내용이 그대로 있는데                                              

   ln명령은 원본 파일의 내용을 바꾸면 링크된 파일의 내용도 바뀜                                                       

* 링크된 파일의 어느 한 파일을 수정하면 링크된 다른 파일 모두가 수정됨                                                 

* 특정 파일이 ln멸령으로 생성된 다른 파일에 관계없이 실제로는 하나의 파일만 존재하는 것을 의미                         

* 링크를 부여하는 방법으로는 하드링크와 심볼릭링크가 있음                                                              

* 일반적으로 사용자들이 주로 사용하는 링크는 심복릭링크이며, 윈도우의 바로가기 아이콘도 심볼릭링크                     

                                                                                                                       

하드링크(Hard Link)                                                                                                    

* 하드 링크는 일반 파일을 링크할 때 주로 이용하며, 옵션없이 ln 명령으로 링크시키면 된다. 생성된 링크 파일은 원     래 파일의 inode(index node라 하며 파일에 대한 정보가 저장된 레코드)를 그대로 참조하기에 원 파일이 지워져도    아무런 문제가 되지 않는다.

* 하나의 파일에 여러 개의 이름을 부여하는 것                                                                           

* 같은 파일을 이름만 다르게 부르는 것                                                                                  

* 원본 파일과 같은 데이터 파일을 공유                                                                                  

* 원본 파일의 이름이 바뀌어도 사용이 가능                                                                              

* 파일을 없애려면 링크로 생성된 링크 파일을 모두 지워야 함                                                             

* 다른 파일 시스템 간에는 링크를 할 수 없음                                                                            

*사용방법 : $ln(원본파일명)(대상파일명)                                                                                

                                                                                                                       

심볼릭링크(Symbolic Link)                                                                                              

* 심볼릭 링크는 주로 디렉토리를 링크할 때 사용한다. 원 파일이 삭제되면 실제 데이터 블럭을 참조하던 inode도 삭      제되어, 심볼릭 링크된 파일은 의미가 없어진다.

* 윈도우 운영체제의 '바로가기 아이콘'과 유사                                                                           

* 링크로 생성된 파일에 내용은 존재하지 않으며, 각각의 i-node를 가진 또 다른 파일이 어디를 가리키고 있는지 알려주는 역할

* 하드링크와는 다르게 링크를 다른 곳으로 이동시키면 링크가 깨져서 사용을 하지 못함                                     

* 다른 파일 시스템 간에 생성할 수 있어 다른 파티션에 링크 파일을 생성 가능                                             

* 원본파일 이름이 바뀌면 사용하지 못함                                                                                 

*사용방법 : $ln -s(원본파일명)(대상파일명)



Usage: ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)

  or:  ln [OPTION]... TARGET                  (2nd form)

  or:  ln [OPTION]... TARGET... DIRECTORY     (3rd form)

  or:  ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

In the 1st form, create a link to TARGET with the name LINK_NAME.

In the 2nd form, create a link to TARGET in the current directory.

In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.

Create hard links by default, symbolic links with --symbolic.

When creating hard links, each TARGET must exist.

긴 옵션에서 꼭 필요한 인수는 짧은 옵션에도 꼭 필요합니다.

      --backup[=CONTROL]      make a backup of each existing destination file

  -b                          like --backup but does not accept an argument

  -d, -F, --directory         allow the superuser to attempt to hard link

                                directories (note: will probably fail due to

                                system restrictions, even for the superuser)

  -f, --force                 remove existing destination files

  -n, --no-dereference        treat destination that is a symlink to a

                                directory as if it were a normal file

  -i, --interactive           prompt whether to remove destinations

  -s, --symbolic              make symbolic links instead of hard links

  -S, --suffix=SUFFIX         override the usual backup suffix

  -t, --target-directory=DIRECTORY  specify the DIRECTORY in which to create

                                the links

  -T, --no-target-directory   treat LINK_NAME as a normal file

  -v, --verbose               print name of each file before linking

      --help     이 도움말을 표시하고 끝냅니다

      --version  버전 정보를 출력하고 끝냅니다


The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.

The version control method may be selected via the --backup option or through

the VERSION_CONTROL environment variable.  Here are the values:

none, off       never make backups (even if --backup is given)

numbered, t     make numbered backups

existing, nil   numbered if numbered backups exist, simple otherwise

simple, never   always make simple backups



Bash

위키백과, 우리 모두의 백과사전.


Bash (Bourne-again shell, 본 어게인 셸)은 본 셸을 대체하는 자유 소프트웨어로서 GNU 프로젝트를 위해 브라이언 폭스(Brian Fox)가 작성한 유닉스 셸이다.[2][3] 1989년 발표되어 GNU 운영 체제와 리눅스맥 OS X 그리고 다윈 등 운영 체제의 기본 셸로 탑재되어 광범위하게 배포 되었다. 또한 DJGPP와 노벨 넷웨어에 의해 도스로 이식되었고 시그윈과 MinGW의 배포로 마이크로소프트 윈도로 이식되었다.

특성[편집]

Bash 명령어의 문법은 거의 대부분이 sh와 호환되어 쓰일 수 있다. 또한 kshcsh 에서 많은 아이디어를 받아서 명령 히스토리, 디렉터리 스택, $RANDOMPOSIX 형식 명령어 치환 등을 지원한다. 또한 입력 중에 명령어나 파일 이름을 자동 완성해 주는 기능도 지원한다.

주석[편집]

  1. 이동 GNU Project. README file. “Bash is free software, distributed under the terms of the [GNU] General Public License as published by the Free Software Foundation, version 3 of the License (or any later version).”
  2. 이동 Richard Stallman (forwarded with comments by Chet Ramey) (February 10, 1988). GNU + BSD = ?. comp.unix.questions. Mar 22, 2011에 확인. “For a year and a half, the GNU shell was "just about done". The author made repeated promises to deliver what he had done, and never kept them. Finally I could no longer believe he would ever deliver anything. So Foundation staff member Brian Fox is now implementing an imitation of the Bourne shell.”
  3. 이동 [Hamilton] (May 30, 2008). The A-Z of Programming Languages: BASH/Bourne-Again Shell. 《Computerworld》: 2. Mar 21, 2011에 확인. “When Richard Stallman decided to create a full replacement for the then-encumbered Unix systems, he knew that he would eventually have to have replacements for all of the common utilities, especially the standard shell, and those replacements would have to have acceptable licensing.”

바깥 고리[편집]



Bash demo.png
Bash와 본 셸 세션의 화면
원저자브라이언 폭스
발표일1989년 6월 7일
최근 버전4.2
(2011년 02월 13일, 1124일 경과)
프로그래밍 언어C
운영 체제크로스 플랫폼
플랫폼GNU
언어영어, 다국어
종류유닉스 셸
라이선스GNU 일반 공중 사용 허가서 버전 3+[1]
웹사이트Bash GNU 프로젝트 웹 사이트


http://askubuntu.com/questions/361040/eclipse-menus-are-cut-off-or-dont-show#363237


How To solve Eclipse menu issues in Ubuntu 13.10

(Stable way, until someone fixes the bug)

This method takes for granted that you already have your eclipse.desktop file (or that you can alternatively create a new one from scratch). Otherwise, you can momentarily take a look at the "fast way" below.

  1. Open your eclipse.desktop file:

    sudo -H gedit /usr/share/applications/eclipse.desktop
    

    (If you can't find it in this path, try in ~/.local/share/applications/eclipse.desktop. Otherwise, you could have to find yours using locate command).

  2. Replace the Exec= line with this:

    Exec=env UBUNTU_MENUPROXY= eclipse
    

    Where "eclipse" is the path to your eclipse executable. In this case it's just "eclipse" since there's a symlink in /usr/bin folder.

    NOTE: If you can't find your eclipse.desktop file, you can simply create one from scratch in the above path, and fill it with these lines:

    [Desktop Entry] 
    Type=Application 
    Name=Eclipse 
    Icon=eclipse 
    Exec=env UBUNTU_MENUPROXY= eclipse 
    Terminal=false 
    Categories=Development;IDE;Java;
    
  3. Save the file.

Now you can run Eclipse from its icon as usual.

(Fast but repetitive way)

If you haven't got any eclipse.desktop file and you don't want to create it at the moment, you can simply run Eclipse with this command:

UBUNTU_MENUPROXY= eclipse

where "eclipse" is the path to your eclipse executable. Note that this is just the fast way to run Eclipse once. If you don't want to remember this command and use it every time you have to run Eclipse, follow the "stable way" above.

linux에서 Crontab을 등록하는 방법은 두가지가 있는데 각 방법은 아래와 같다.

 

# vi /etc/crontab

# crontab -e

 

가끔 /etc/crontab에 등록하면 문제가 없는데 crontab –e 로 등록하면 실행이 안 되는 경우가 있었다. 오래 전 일이라 왜 그랬는지 잘 기억이 안 나지만 아마 환경변수 탓일 것이었을 꺼라고 생각한다. 참고로 root사용자로 crontab –e 에 저장을 하면 아래 경로에 파일이 생긴다.

# /var/spool/cron/root

 

결국 /etc/crontab과 동일한 설정인 것이다. 차이가 있다면 /etc/crontab에서는 실행될 사용자까지 명시해줘야 하지만 crontab –e로 수정할 때는 쓰지 않아도 된다.

 

yum install 로 jenkins를 못찾을 때 다음 과 같이 repo를 등록하고 하자.

# sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

# sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

# sudo yum install jenkins

 

오늘 Svn 이 자동 실행되지 않아서 귀찮은 일이 발생했다. (뭔가 건드려야 하는 일이 생기면 귀찮아지기 마련이다.) 그래서 다음과 같이 chkconfig에 추가했다.

 

# chkconfig svnserve on

 

svnserve는 실행 시 저장소(repository) 경로 설정을 해야 하므로 한가지 더 수정해야 한다.

 

# vi /etc/init.d/svnserve

 

윗부분 아무곳이나 아래

reporoot=/data/svn/

exec=/usr/bin/svnserve

prog=svnserve

pidfile=${PIDFILE-/var/run/svnserve.pid}

lockfile=${LOCKFILE-/var/lock/subsys/svnserve}

args="--daemon --pid-file=${pidfile} $OPTIONS"

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

 

(중략)

 

daemon --pidfile=${pidfile} $exec -r $reporoot $args


그리고 서비스를 시작하자.


# service svnserve start


우선 재 부팅을 한다. 부팅할 때 shift 키를 누르고 있으면 GRUB 메뉴로 들어가게 되는데, 여기서 memtest86+ 메뉴를 선택하면 아래 화면과 같이 나오면서 메모리를 체크하게 된다.

 

내 노트북은 8GB 램을 꼽았는데 너무 시간이 오래 걸려서 끝까지 테스트는 못해봤다. 하드웨어 메모리카드에 이상이 있는 것으로 예상된다면 한번씩 해보면 도움이 될 것이다.

 

https://help.ubuntu.com/community/MemoryTest

 

Lenovo E330 (가격대비 성능 꽤 좋다. ^^)

아래는 repo의 저장소의 /trunk/prj 를 repo2로 복사하는 예 이다.

 

저장소 전체 덤프

# svnadmin dump /data/repo/ > data.dump

 

특정 경로 포함

# cat data.dump | svndumpfilter --drop-empty-revs --renumber-revs include /trunk/prj > dump2.dump

 

특정 경로 제외 (필요한 경우, 추가 필터가 필요한 경우 사용)

# cat data.dump | svndumpfilter --drop-empty-revs --renumber-revs exclude [제외경로명] > dump2.dump

 

덤프 복구

# svnadmin load /data/repo2 < ./data2.dump

 

 

http://cronolog.org/download/index.html

 

위 링크에서 최신버전 다운로드 또는 아래와 같이 wget 이용

# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz

 

 

압축해제 등 설치 절차

 

# tar zxvf cronolog-1.6.2.tar.gz

# cd ./cronolog-1.6.2

# ./configure

# make

# make install

 

이렇게 하면 아래 경로에 설치가 완료된다.

# /usr/local/sbin/cronolog

svn 서버를 시작하기 위해서는 다음과 같이 입력해야 한다.


# svnserve -d -r 저장소경로



linux에서 bash를 이용해서 html 파일 한번에 인코딩 변경하기

iconv를 사용하는 것이 주된 내용이다. 다음 스크립트를 사용하면 된다.

   

사용법: iconv.sh ./path.../

   

   

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

   

#!/bin/bash


if [ $1 ];

then

  for f in `ls -al $1 | awk '{print $9}' | grep .htm`

  do

    p=`echo $1 | sed "s/\/$//"`

    t=$p/$f

    tmp="$t"_tmpconv


    iconv $t -c -f euc-kr -t utf-8 | sed "s/charset=euc-kr/charset=utf-8/" > $tmp

    mv -f $tmp $t

    chown deXman:deXman $t

  done

else

  echo "how to use: iconv.sh [path]"

fi


linux 에서는 su를 이용하면 다른 사용자로 로그인 할 수 있다.

 

user@localhost:~$ su -

Password:

 

root@localhost:~$

 

 

그런데 su가 나는 그 동안 Substitute User의 약자로 알고 있었고 누군가 Super User 라고 예기할 때 속으로 틀리지 않았나 라고 생각했었는데... 오늘 위키 페이지를 보니 다음 세가지 의미를 가진단다. 틀리다고 말했다가 창피당할 뻔 했다. ^^;;

 

  • substitute user
  • super user
  • switch user

 

http://en.wikipedia.org/wiki/Su_(Unix)

 

다음과 같이 uptime을 입력해보자.

 

# uptime

18:07:55 up 412 days, 10:35, 2 users, load average: 0.10, 0.17, 0.16

 

그럼 위와 같은 결과를 볼 수 있을 텐데 각 의미는 순서대로 얼마나 오랫동안 서버가 운영되고 있는지, 현재 몇 명이 로그인하고 있는지, 그리고 중요한 현재 1분, 5분, 15분의 평균 실행 프로세스 개수를 나타낸다. 여기에 나오는 load average의 개수로 서버 부하를 가늠해볼 수 있다. (높을 수록 부하가 큰 상태이다.)

 

mod_speling를 이용한다. 대부분 기본으로 설치되어 있으니 옵션만 설정하면 된다. 다음과 같이 해보자.

 

CheckSpelling on

 

예를 들어 나는 VirtualHost로 사이트를 구성하고 있기 때문에 아래와 같이 특정 디렉터리만 대소문자 구분하지 않게 설정했다.

 

<VirtualHost...>

  <Directory ...>

    CheckSpelling on

  </Directory>

</VirtualHost>

 

 

아래는 아파치 문서(http://httpd.apache.org/docs/2.2/mod/mod_speling.html)에 나와있는 spelling 모듈은 사용할 때 알아야 할 점들이다.

 

  • the directory scan which is necessary for the spelling correction will have an impact on the server's performance when many spelling corrections have to be performed at the same time.
  • the document trees should not contain sensitive files which could be matched inadvertently by a spelling "correction".
  • the module is unable to correct misspelled user names (as in http://my.host/~apahce/), just file names or directory names.
  • spelling corrections apply strictly to existing files, so a request for the <Location /status> may get incorrectly treated as the negotiated file "/stats.html".

 

광범위하게 이 모듈을 사용할 경우 서버 성능에 영향을 줄 수도 있을 것 같고, 중요한 파일의 경우는 사용하지 않는 것이 좋을 것 같다. 또한 이 모듈은 301 permanent redirection 응답을 통해 파일 대소문자를 교정하므로 한번 클라이언트에게 전송된 수정된 내용을 쉽게 바꿀 수 없어 파일이름의 수정이 잦을 경우 신중해야 할 것 같다.

현재 나는 ubuntu를 사용하고 있는데 블로그 포스트 할때마다 윈도우에서 블로그 api를 통해 MS워드로 쉽게 포스트 하는것에 비해 불편하다고 느껴서 linux에 쓸만한 블로그 writer 클라이언트가 있는지 검색해보게 되었고 다음과 같은 링클를 발견할 수 있었다.


http://www.makeuseof.com/tag/6-free-blog-editors-that-you-can-use-on-your-linux-desktop/

http://www.labnol.org/software/download/best-desktop-blogging-clients-linux/3491/


  • BloGtk
  • Thingamablog
  • ScribeFire
  • Drivel
  • Gnome Blog Editor
  • QTM

총 6개를 주요로 소개하고 있는데... 결론는 MS워드 만큼 쓸만한게 없다는 결론. 슬프다... 


 

#!/bin/bash

 

echo 'kill django process...'

for pid in `ps aux | grep 'manage.py' | grep -v 'grep' | awk '{print $2}'`; do

  echo kill $pid

  kill -9 $pid

done

/etc/resolv.conf 수정하여 다음과 같이 설정한다.

 

nameserver xxx.xxx.xxx.xxx

nameserver xxx.xxx.xxx.xxx

 

순서대로 1차, 2차 또는 추가로 기입할 수 있다.

아래처럼 한글 또는 문자가 깨져 보일 때에는

â"œâ"€atd

â"œâ"€auditdâ"€â"¬â"€audispdâ"€â"€â"€{audispd}

â"‚ â""â"€{auditd}

â"œâ"€automountâ"€â"€â"€4*[{automount}]

â"œâ"€avahi-daemonâ"€â"€â"€avahi-daemon

â"œâ"€crond

â"œâ"€dbus-daemonâ"€â"€â"€{dbus-daemon}

â"œâ"€events/0

â"œâ"€events/1

â"œâ"€exim

â"œâ"€gam_server

 

아래와 같이 입력해보자.

# unset LANG

다음과 같이 설정하면 된다.

:set expandtab

 

추가로 Tab 간격이 너무 넓어 공백 4개로 변경하고 싶을때는 다음과 같이 한다.

:set tabstop=4

:set shiftwidth=4

:set expandtab

 

또는, 간단하게 한문장으로...

:set tabstop=4 shiftwidth=4 expandtab

 

http://vim.wikia.com/wiki/Converting_tabs_to_spaces 참고

http://cronolog.org 참고

cronolog 를 이용하면 로그를 저장할 때 날짜, 시간으로 파일을 자동으로 쉽게 나눌 수 있게 해준다. 개인적으로는 Apache에서 로그 기록할 때 많이 사용하고 있고 예를 들어 다음과 같이 쓴다.

 

TransferLog "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/access.log"

ErrorLog "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/errors.log"

CustomLog "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/custom.log" common

 

위 설정된 로그는 다음과 같이 별도 구분된 폴더에 저장된다.

추가로 여기서 common은 Common Log Format을 사용함을 의미한다.

 

/web/logs/2002/12/31/access.log

/web/logs/2002/12/31/errors.log

 

하지만 폴더가 구분되면 관리가 어려워져서 개인적으로는

/errors.log_%Y%m%d" 과 같이 파일이름만 구분하고 같은 폴더에 저장하는 형식을 선호한다.

Lighttpd 설치

sudo apt-get -y install lighttpd

 

FastCGI 모듈 활성화

sudo lighttpd-enable-mod fastcgi

sudo /etc/init.d/lighttpd restart

 

PHP 설치

sudo apt-get -y install php5-cgi

 

MySQL 설치

sudo apt-get -y install php5-mysql mysql-server

+ Recent posts