ssh를 사용하면 sftp는 기본으로 사용할 수 있게 된다.
문득, sftp를 막을 수 있는 방법을 없을까? 라는 생각이 들었는데..
아래의 링크에서 사용하지 못하도록 하는 방법을 찾게 되었다.

$ vi /etc/ssh/sshd_config
 72 # Allow client to pass locale environment variables
 73 AcceptEnv LANG LC_*
 74
 75 Subsystem sftp /usr/lib/openssh/sftp-server
 76
 77 UsePAM yes



 75 #Subsystem sftp /usr/lib/openssh/sftp-server
로 해주면 된다고 한다.

※ ubuntu 9.04의 sshd_config파일 행번호임.

원본 내용은 RHEL(RedHat Enterprise Linux) 에 적용되지만
Ubuntu 9.04 역시 동일하게 존재한다.

[링크 : http://blog.seabow.pe.kr/513]


배포판마다 다르지만 sftp-server 라는 실행파일이 존재합니다
/usr/lib/sftp-server에 없다면 find로 검색해서 찾아보시기 바랍니다.
#find / -name sftp-server  (root권한으로 하는게 좋습니다.)
하면 경로가 나옵니다.
그 경로가 만약
/usr/lib/misc/sftp-server면 이 경로를

#echo "/usr/lib/misc/sftp-server" >> /etc/shells 로 허가 쉘 목록에 추가해줍니다.
그런후에
#usermod -s /usr/lib/misc/sftp-server  사용자id
해주면 그 사용자는 sftp만 허용됩니다.

[링크 : http://phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_install&wr_id=82505]

Posted by 구차니
프로그램 사용2009. 6. 4. 19:24
JPEG 하면 EXIF가 먼저 떠오르는건 디카의 위력일려나..

[jhead : http://www.sentex.net/~mwandel/jhead/]
[libexif : http://sourceforge.net/projects/libexif]
[libjpeg exif patch : http://sylvana.net/jpegcrop/exifpatch.html]
Posted by 구차니
프로그램 사용/gcc2009. 5. 28. 23:06
오늘 희한한 switch - case문을 들었다

case 1 ... 10:

이런식으로 기존에는
case 1:
case 2:
...
case 9:
case 10:
이라고 쓰던것을 줄여 쓸수 있다고 한다.

검색을 해보니 c#과 gcc에서 지원하고 C99 등에는 검색이 걸려 나오지 않는다.
정체가 머냐?


[링크 : http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic62939.aspx]
[링크 : http://www.devhood.com/messages/message_view-2.aspx?thread_id=13708]
Posted by 구차니
노트북에서 테스트한 SSH + Cygwin/X + VNC 조합은 이상없이 작동하는데..
SSH + Xming + VNC 조합은 VNC가 먹통이 된다..


머가 문제일까?



일단은 VNC는 몇번에 할지 방법이 없으니..
Xming을 localhost:1로 하고 실행하니 이상없이 잘된다..
세션 번호 충돌인가?
Posted by 구차니
프로그램 사용/libjpeg2009. 5. 27. 19:29
libjpeg는 말그대로 jpeg을 위한 라이브러리이다.

이 녀석으로 할 수 있는 것은,
일정 사이즈로 resize(리사이즈) 혹은 scale/scaling(스케일링) 하는 것과
jpg를 bmp로 변환하는 것이다. djpeg를 보면 다른 bmp 포맷으로도 변환이 가능하지만,
윈도우 기반의 Bitmap으로만 할줄을 알아서..(헤더만 차이가 있을려나..)

아무튼 자세한 내용은 libjpeg에 들어있는 libjpeg.doc 을 참조 하면 되지만
한가지 애매한 부분이 있어 추가를 한다.

jpeg_read_header(&cinfo, TRUE);

이부분은 말그대로 jpeg 파일의 크기등의 각종 정보를 불러온다.
그리고 그 정보를 바탕으로 scaling을 준비한다. 그리고 나서

jpeg_start_decompress(&cinfo);

위의 함수를 호출하여(정확하게는 매크로) jpeg 을 bitmap으로 변환한다.
아래는 변환 부분의 소스코드이며,

cinfo.scale_num = 1;
cinfo.scale_denom = 8;

부분의 값으로 인해서 1/8 크기로 축소되어 변형된다.
(이로인해 preview 시에 상당히 빠르게 볼 수 있다. 그리고 jpeg6b 버전의 최대값이 1/8 이다)
	struct jpeg_decompress_struct cinfo;
	struct jpeg_error_mgr jerr;
	FILE * infile;
	unsigned char *data_ori = NULL;
	unsigned char *data = NULL;
	int		calc_width;

	cinfo.err = jpeg_std_error(&jerr);
	jpeg_create_decompress(&cinfo);
		jpeg_stdio_src(&cinfo, infile);
		jpeg_read_header(&cinfo, TRUE);
			cinfo.scale_num = 1;
			cinfo.scale_denom = 8;
		jpeg_start_decompress(&cinfo);
			calc_width = (cinfo.output_width * cinfo.jpeg_color_space + 3) / 4 * 4;
			data = data_ori = malloc(calc_width * cinfo.output_height);
			if(data == NULL)
			{
				jpeg_finish_decompress(&cinfo);
				jpeg_destroy_compress(&cinfo);

				fclose(infile);
				return FALSE;
			}

		while (cinfo.output_scanline < cinfo.output_height)
		{
			jpeg_read_scanlines(&cinfo, &data, 1);
			data += calc_width;
		}

		jpeg_finish_decompress(&cinfo);
	jpeg_destroy_compress(&cinfo);

fclose(infile); free(data_ori);

calc_width = (cinfo.output_width * cinfo.jpeg_color_space + 3) / 4 * 4;

이 부분은 bitmap특성상 4byte align이 되어야 하므로, 4바이트 단위로 끊어주는 계산을 해준다.
아래의 data += calc_width; 에서 사용된다.
Posted by 구차니
캠타시아가 유명하다는데.. 일단 유료는 패스~

캠스튜디오와 코덱은 GPL이라서 누구든지 무료로 사용이 가능하다.
그리고 풀스크린에서도 끊김없이 잘 녹화가 된다(D3D 이런건 안해봤으니 -ㅁ-)


 


인스톨러용량은 1.30MB (1,364,995 바이트) 로 매우 저렴하다
위에 보면 알겠지만, SWF 툴바를 누르면 Record to AVI / SWF로 전환이 되며,


Region 메뉴를 통해 특정영역(Region) 정해진 영역(Fixed Region) 그리고 전체 화면(Full Screen)을 녹화할 수 있다.


정해진 영역(Fixed Region)은 특정 크기 및 위치를 고정하여 녹화할 수 있도록 해주며,
아래의 체크 박스를 이용하면 녹화중에 위치를 변환할 수 있다.(물론 시간은 계속 간다)


특정영역(Region)을 선택하는 화면이며, 영역 선택 후 즉시 녹화가 시작된다.


녹화 제어는 꼭꼭 숨겨진 단축키를 사용하면 된다.
위는 기본값으로 설정된 단축키
[공식 : http://camstudio.org/]

Posted by 구차니
프로그램 사용/vi2009. 5. 26. 22:51
1.3. Install Vim on Debian GNU/Linux

To install Vim on Debian Linux (GNU Linux), login as root and when connected to internet type -

apt-get install vim vim-rt

It will download the latest version of vim, install it, configure it. The first package listed is vim, the standard editor, compiled with X11 support, vim-rt is the vim runtime, it holds all the syntax and help files.

On Debian 3.0 (woody) and above, use 'apt-get install vim' instead. The vim-rt package is part of the main vim package.

[링크 : http://www.faqs.org/docs/Linux-HOWTO/Vim-HOWTO.html]


우분투에 9.04 기본으로 설치된 VI는 문법강조가 작동하지 않는다.
그래서 위의 방법대로 했더니 vim-rt는 존재하지 않고 vim-runtime 패키지가 존재 한다.

$ sudo apt-get install vim
라고 입력하면 알아서 추천하고 알아서 설치해준다.
Posted by 구차니
프로그램 사용/coLinux2009. 5. 22. 00:20
포터블 우분투는 colinux 기반으로
정말 간편하게 사용할 수 있는 프로그램이다

pubuntu@pubuntu:/bin$ file ls
ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped

pubuntu@pubuntu:~/src$ gcc test.c
test.c: In function ‘main’:
test.c:2: warning: return type of ‘main’ is not ‘int’
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status

우분투 특성상 gcc가 제대로 안되서(crt1.o 도 없어서 컴파일 에러 ㅠ.ㅠ)
그냥 /bin/ls의 포맷을 살펴 보았더니 ELF x86이다.

이 말은 별다른 컴파일 과정없이 , VMWare등의 가상PC 없이도
윈도우와 리눅스를 병행해서 사용이 가능하다는 것이다.
네트워크 문제인지 모르겠지만.. 네트워크 사용시 CPU 점유율이 극도로 올라가는 문제 발생..



주의사항
1. 실행시에는  portable_ubuntu.bat 대신 run_portable_ubuntu.bat 을 이용하여 실행하도록!
   (Xming 구동이라던가 여러가지 에서 차이가 있다)
2. 설치이후 키보드를 Korean / 101키 호환으로 해주지 않으면 - + 등의 특수키가 제대로 먹지 않을수도 있다.
3. vi에서 방향키가 안먹는다.. OTL
4. 되도록이면... 암호를 바꾸자. 기본 암호는 123456 이다.
5. USB에 담고 싶으면 2GB 이상의 USB가 필요하다. 아래 다운로드는 400MB 정도이지만 압축풀면 1.8기가이다

[발견 : http://www.choboweb.com/900]
[다운로드 : http://portableubuntu.sourceforge.net/index.php?section=download]
Posted by 구차니
프로그램 사용/libjpeg2009. 5. 21. 10:47
JPEG parameter struct mismatch: library thinks size is 520, caller expects 464

라이브러리를 겨우겨우 컴파일 해서 돌려봐야지~ 룬루랄라 하고 돌렸더니
저따구 에러가 발생을 한다.. 닝기리

아무튼 해결 방법은
typedef 로 묶인 기본 타입들에 대한 정의를 수정해 주면 된다는 것이다.

일단 가장 큰 차이는 boolean의 크기가 다르다는 것이고,
나머지 타입들은 시스템에 따라 미묘하게 다를수 있으니 현재 사용하는 시스템의 타입으로 변경해주면 된다.


/* These typedefs are used for various table entries and so forth.
 * They must be at least as wide as specified; but making them too big
 * won't cost a huge amount of memory, so we don't provide special
 * extraction code like we did for JSAMPLE.  (In other words, these
 * typedefs live at a different point on the speed/space tradeoff curve.)
 */

/* UINT8 must hold at least the values 0..255. */

#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char UINT8;
#else /* not HAVE_UNSIGNED_CHAR */
#ifdef CHAR_IS_UNSIGNED
typedef char UINT8;
#else /* not CHAR_IS_UNSIGNED */
typedef short UINT8;
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */

/* UINT16 must hold at least the values 0..65535. */

#ifdef HAVE_UNSIGNED_SHORT
typedef unsigned short UINT16;
#else /* not HAVE_UNSIGNED_SHORT */
typedef unsigned int UINT16;
#endif /* HAVE_UNSIGNED_SHORT */

/* INT16 must hold at least the values -32768..32767. */

#ifndef XMD_H			/* X11/xmd.h correctly defines INT16 */
typedef short INT16;
#endif

/* INT32 must hold at least signed 32-bit values. */

#ifndef XMD_H			/* X11/xmd.h correctly defines INT32 */
typedef long INT32;
#endif

/*
 * On a few systems, type boolean and/or its values FALSE, TRUE may appear
 * in standard header files.  Or you may have conflicts with application-
 * specific header files that you want to include together with these files.
 * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
 */

#ifndef HAVE_BOOLEAN
typedef int boolean;
#endif

Posted by 구차니
프로그램 사용/libjpeg2009. 5. 20. 21:49
상당히 끙끙대게 하던 녀석인데.. 겨우겨우 해결이 되었다..
해결 방법은 의외로 간단하다.(안해보고 고생 안했으면 말을 하지마세요?!)

1. ./configure --prefix=$(TARGET_ROOT_FS)/usr CC=$(CROSS)-gcc

2. vi Makefile
 38 # If using GNU libtool, LIBTOOL references it; if not, LIBTOOL is empty.^M
 39 LIBTOOL = ./libtool^M
※ libtool은 쉘스크립트로 내용을 수정해야 하므로, 편의상 jpeg-6b 디렉토리에 복사를 하였다.

3. vi libtool
262 # The linker used to build libraries.
263 LD=$(CROSS)-ld
264 #LD="/usr/bin/ld"
※ libtool은 쉘스크립트로 내용을 수정해야 하므로, 복사본을 사용하도록 한다.



make install 시에는
$(TARGET_ROOT_FS)/usr/bin 이 존재하지 않으면 에러가 발생하므로 미리 확인하거나
cjpeg / djpeg / jpegtran / rdjpegcom / wrjpegcom 이 필요 없다면 무시해도 된다.

[링크 : http://metastatic.org/text/libtool.html]
Posted by 구차니