'OS/Unix/Linux'에 해당되는 글 11건
- sar 간단 정리 2012.11.12
- [linux] log files & how to see 2012.09.16
- [linux] sshd 보안 설정 2012.09.16
- [ubuntu] open files limit 변경하기 2012.09.16
- [Ubuntu] downgrade subversion 1.7 to 1.6 2012.09.16
- [linux] cpu info 2012.09.16
- ubuntu,centos - equinox-faenza theme install 2012.04.15
- [Ubuntu] 우분투 설치 후 할 일들 2011.06.03
- CPU load 이해하기 2011.04.22
- KT-ucloud cs 하드디스크 LV 마운트하기 2 2011.03.14
sar 간단 정리sar 간단 정리
Posted at 2012. 11. 12. 01:21 | Posted in OS/Unix/Linuxsar 에서 날짜가 깨져서 나올때, (mpstat, vmstat 등 다른 도구들도 마찬가지)
LC_TIME=C 로 설정하면 됨. (LC_TIME= 하면 원래대로 돌아감. LC_ALL 또는 LANG 의 값을 사용하게 됨.)
LANG 또는 LC_ALL=C로 해도 무방. 자세한건 locale 설정 방법 검색 ㄱㄱ
sar [-u] 가 기본
sar -s <hh:mm:ss> -e <hh:mm:ss> 로 시작/끝 시간 지정할 수 있다.
sar <interval> <count> 로 정해진 주기로 자동 호출되게 할 수 있다.
sar -f /var/log/sa/sa16 해당날짜(16일)의 통계를 본다.
sar -A 모든 정보 출력
sar -c 새롭게 만들어져 활동하고 있는 프로세스
sar -n DEV | EDEV | SOCK 네트워크 통계 (DEV: network device 통계, EDEV: network device 에러 통계, SOCK: socket 통계)
sar -q 실행 대기 중인 프로세스를 점검. 시스템의 load average를 나타낸다.
각 옵션별 상세 설명은 여기 참조: http://www.cubrid.com/zbxe/71317
[linux] log files & how to see[linux] log files & how to see
Posted at 2012. 9. 16. 13:53 | Posted in OS/Unix/Linux
/var/log/wtmp : 사용자 login & logout & reboot 로그
$ last
/var/log/btmp : 로그인 실패 로그
$ lastb
01.
짱깨들이 로그인하려고 돌린 흔적으로 용량이 300MB가 넘었다..
02.
-rw------- 1 root utmp 309M Jun 11 11:55 btmp
03.
04.
test
ssh
:notty 119.10.114.184 Mon Apr 16 19:37 - 19:37 (00:00)
05.
test
ssh
:notty 119.10.114.184 Mon Apr 16 19:37 - 19:37 (00:00)
06.
oracle
ssh
:notty 119.10.114.184 Mon Apr 16 19:37 - 19:37 (00:00)
07.
oracle
ssh
:notty 119.10.114.184 Mon Apr 16 19:37 - 19:37 (00:00)
08.
root
ssh
:notty 119.10.114.184 Mon Apr 16 19:37 - 19:37 (00:00)
09.
root
ssh
:notty 119.10.114.184 Mon Apr 16 19:37 - 19:37 (00:00)
10.
root
ssh
:notty 119.10.114.184 Mon Apr 16 19:36 - 19:36 (00:00)
11.
root
ssh
:notty 119.10.114.184 Mon Apr 16 19:36 - 19:36 (00:00)
12.
unabv
ssh
:notty 119.10.114.184 Mon Apr 16 19:36 - 19:36 (00:00)
13.
unabv
ssh
:notty 119.10.114.184 Mon Apr 16 19:36 - 19:36 (00:00)
14.
rramirez
ssh
:notty 119.10.114.184 Mon Apr 16 19:36 - 19:36 (00:00)
15.
16.
$ whois 119.10.114.184
17.
[Querying whois.arin.net]
18.
[Redirected to whois.apnic.net]
19.
[Querying whois.apnic.net]
20.
[whois.apnic.net]
21.
% [whois.apnic.net node-3]
22.
% Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
23.
24.
inetnum: 119.10.0.0 - 119.10.127.255
25.
netname: XinnetIDC
26.
country: CN
27.
descr: XinNet Technology Corp.
28.
descr: 1st Floor, 2nd Building Section A,
29.
descr: BDA BeiGongDa Soft-ware Area, Beijing China. &
lt
;-- 중국애들 맞네..
파일 비우기(clear btmp)
cat /dev/null > /var/log/btmp
/var/log/messages : 시스템 에러 및 하드웨어 에러 로그
$ vi messages
/var/log/secure : 사용자 인증관련 로그
$ vi secure
/var/log/lastlog : 사용자 최종 로그인 정보
$ lastlog
현재 접속자 정보 보기
$ w
$ who
[linux] sshd 보안 설정[linux] sshd 보안 설정
Posted at 2012. 9. 16. 13:48 | Posted in OS/Unix/Linux출처: http://mrain7.egloos.com/2391163
/etc/ssh/sshd_config
Root 로그인 차단
공격자 또는 내부 사용자가 root로 접근 가능할 경우 암호 무작위 입력으로 권한을 획득할 수 있습니다. 따라서, root 로그인을 차단, 일반 계정을 통하여 접근토록 하여야 합니다.Root 로그인 허용이 yes로 되어 있으면 no로 수정합니다.
#PermitRootLogin no
- 주석처리를 지우면 된다.
Forwarding 막기
만약, TCP 포트와 X11에 대한 포워드 기능을 사용하지 않는다면 비활성화 하시기 바랍니다.
AllowTcpForwarding no
X11Forwarding no
호스트 기반 인증 차단
Rhosts 사용이나 hosts.equiv를 통한 인증을 차단합니다. Rhost는 보안상 취약함으로 비활성화 합니다.
IgnoreRhosts yes
HostbasedAuthentication no
RhostsRSAAuthentication no
Port 변경하기
Port <변경할포트번호>
ssh port를 변경한 경우 클라이언트 측에서는 다음과 같은 설정을 해두고 사용하면 편하다.
http://blog.naver.com/deepblue28?Redirect=Log&logNo=140157240471&from=postView
해당 IP만 접속 허가 또는 거부
/etc/host.allow 와 host.deny
* 그 외 상세 설정은 evernote에 정리돼 있다. (어디에 적었뒀는지 까먹어대서..)
* ssh brute force attack을 막기 위해 fail2ban 을 사용해보자.
[ubuntu] open files limit 변경하기[ubuntu] open files limit 변경하기
Posted at 2012. 9. 16. 13:40 | Posted in OS/Unix/Linuxredhat(centOS 등)계열은 ulimit -n 으로 쉽게 설정 가능하나,
우분투는 잘 안되네..
다음과 같이 해서 해결.
system-wide limit on the number of open files for all processes
$ cat /proc/sys/fs/file-max
148608
계정별 open file limit
$ ulimit -n
1024
다음 2개 파일을 수정 (box안의 내용을 추가)
/etc/pam.d/common-session ==> 안해도 됨 (/etc/pam.d/login 에 설정돼 있네..)
session required pam_limits.so
/etc/security/limits.conf
* ? nofile 6000
<reboot>
$ ulimit -n
6000
[Ubuntu] downgrade subversion 1.7 to 1.6[Ubuntu] downgrade subversion 1.7 to 1.6
Posted at 2012. 9. 16. 13:37 | Posted in OS/Unix/Linux이클립스 subclipse를 깔았다가, javaHL 버전이 안맞느니 어쩌고 해서
인터넷을 뒤져 1.7.x로 업그레이드 했더니, 기존 repository와 호환이 안되는 문제 발생.
다시 1.6으로 다운그레이드 했다..
(1) 1.7 버전 제거
저장소 정보는 subversion 1.7.x로 맞춰진 상황..
시냅틱 패키지 관리자로 들어가서 subversion, libsn-java, libsvn1 을 삭제.
(2) 1.6 다운로드
패키지 다운로드: http://ppa.launchpad.net/anders-kaseorg/subversion-1.6/ubuntu/pool/main/s/subversion/
다음 3개를 다운로드 받고 순서대로 설치하면 된다.
libsvn1_1.6.5dfsg-1ubuntu1~hardy1~andersk1_amd64.deb
libsvn-java_1.6.5dfsg-1ubuntu1~hardy1~andersk1_amd64.deb
subversion_1.6.5dfsg-1ubuntu1~hardy1~andersk1_amd64.deb
(3) 설치
그냥 설치하면, libneon27, libdb4.6 의존성 어쩌고 하면서 안될텐데, 이 라이브러리들도 의존성 문제로 안된다.
강제로 설치해준다.
$ sudo apt-get -f install libneon27 libdb4.6
그리고, 위에서 다운 받은 3개를 순서대로 설치해준다.
$ sudo dpkg -i libsvn1_1.6.5dfsg-1ubuntu1~hardy1~andersk1_amd64.deb
$ sudo dpkg -i libsvn-java_1.6.5dfsg-1ubuntu1~hardy1~andersk1_amd64.deb
$ sudo dpkg -i subversion_1.6.5dfsg-1ubuntu1~hardy1~andersk1_amd64.deb
$ svn --version --quiet[버전 확인]
[linux] cpu info[linux] cpu info
Posted at 2012. 9. 16. 13:30 | Posted in OS/Unix/Linux물리 cpu 수(설치된 소켓번호)
$ grep “physical id” /proc/cpuinfo | uniq
physical id : 1
물리 cpu 당 코어수
$ grep “cores” /proc/cpuinfo | uniq
cpu cores : 6
하이퍼쓰레딩 적용 여부: “cpu cores”수와 같으면 off, 배수 이면 on
$ grep “siblings” /proc/cpuinfo | uniq
siblings : 12
물리 cpu별 코어 id
$ grep “core id” /proc/cpuinfo | uniq
core id : 0
core id : 1
core id : 2
core id : 8
core id : 9
core id : 10
core id : 0
core id : 1
core id : 2
core id : 8
core id : 9
core id : 10
참고) http://www.richweb.com/cpu_info
ubuntu,centos - equinox-faenza theme installubuntu,centos - equinox-faenza theme install
Posted at 2012. 4. 15. 19:41 | Posted in OS/Unix/Linux
equinox gtk engine
* 미리 설치 할 것들
- yum install gtk2-devel (redhat 계열)
- sudo apt-get install libgtk2.0-dev (ubuntu)
* Install
http://gnome-look.org/content/show.php?content=121881&forumpage=1&PHPSESSID=ccac437ae6db2b803984fb3588d80cd8http://gnome-look.org/content/show.php?content=121881&forumpage=1&PHPSESSID=ccac437ae6db2b803984fb3588d80cd8
tar xzf 121881-equinox-1.50.tar.gz cd equinox-1.50 ./configure --prefix=/usr --enable-animation ./configure --prefix=/usr --libdir=/usr/lib64 --enable-animation make make install |
faenza icon theme
http://code.google.com/p/faenza-icon-theme/downloads/detail?name=faenza-icon-theme_1.1.tar.gz&can=2&q=
faenza-icon-theme_1.1.tar.gz 를 다운 받고 임의의 디렉토리 아래에 풀어놓고 /usr/share/icons 디렉토리로 옮겨놓으면 된다.
equinox evolution themes
http://gnome-look.org/content/show.php?content=140449
140449-equinox-themes-1.50.tar.gz 를 다운 받고, "System > Preference > Appearence" 에서 "설치" 를 눌러 다운 받은 tar.gz 파일을 선택하면 된다.
※ 설치한 테마는 ~/.themes 디렉토리에 저장된다. 잘못 설치했으면 지워주자.
[Ubuntu] 우분투 설치 후 할 일들[Ubuntu] 우분투 설치 후 할 일들
Posted at 2011. 6. 3. 14:11 | Posted in OS/Unix/Linux<한글입력기>
- "시스템 > 관리 > 언어" 에서 "키보드 입력 시스템"을 'nabi'로 변경. (왼쪽shift+space 한영전환 가능)
<Locale>
- 기본은 LANG=ko_KR.utf8 이다. ko_KR.euckr을 사용하려면 locale을 생성해줘야 한다. 다음 순서로 한다.
(Locale 설정을 잘못 건든 경우 아래 순서로 작업해주면 된다.) - $ sudo apt-get install language-pack-ko
- $ sudo locale-gen ko_KR.EUC-KR
- $ sudo dpkg-reconfigure locales
- $ locale -a --> 사용가능한 locale 확인
<Font 설정>
- 나눔고딕, 네이버사전체 설치 (파일 풀어놓고 노틸러스에서 더블클릭하면 바로 설치할 수 있다)
- 우분투는 안티앨리어싱이 기본으로 꺼져있으므로 켜준다.
(http://ihoney.pe.kr/635)
$ sudo gedit /etc/fonts/conf.d/29-language-selector-ko-kr.conf 을 열고
<!-- Turn off antialias and autohint for Korean fonts depending on pixelsize --> 부분과
<!-- Turn off antialias and autohint for ttf-alee depending on pixelsize --> 부분을 주석처리
- Monospace 폰트가 잘못 지정된 경우 폰트매핑 정보를 수정해 준다. (다른 폰트 역시 아래 방법으로 매핑 가능)
$ sudo vi /etc/fonts/conf.d/69-language-selector-ko-kr.conf
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Liberation Mono</string>
<string>DejaVu Sans Mono</string>
<string>나눔고딕코딩</string> <!-- 영문, 한글 폰트를 먼저 나온 순서로 찾으므로 원하는 폰트를 적어준다. -->
<string>네이버사전</string>
<string>UnDotum</string>
<string>Guseul</string>
</edit>
</match>
<테마>
- 아이콘 테마: simple (http://gnome-look.org/content/show.php/Simple?content=99470)
- 테마 파일을 다운로드 받은 후 "시스템 > 기본설정 > 모양" 테마 탭에서 "설치..." 를 눌러 설치한다. - Equinox GTK Theme + Faenza Icon Theme: http://www.techdrivein.com/2010/08/equinox-gtk-theme-faenza-icon-theme.html
$ sudo add-apt-repository ppa:tiheum/equinox && sudo apt-get update
$ sudo apt-get install gtk2-engines-equinox equinox-theme equinox-ubuntu-theme faenza-icon-theme
※ 만약 설치가 안되면 "프로그램 > 우분투 소프트웨어 센터" 에서 equinox, faenza 로 찾아서 설치. - Equinox GTK - Light 테마 + Droid Sans/Droid Sans Mono 폰트 조합이 이쁨.
<SSH>
- ssh 접속 오래 걸리는 문제: GSS 인증 옵션을 끈다.
$ ssh -o GSSAPIAuthentication=no -l <id> <host>
<Samba>
- 시냅틱 패키지 관리자로 samba 설치
- 설정: http://forum.falinux.com/zbxe/?document_srl=518219
<개발환경>
- 설치 목록
$ sudo apt-get install gcc
$ sudo apt-get install g++
$ sudo apt-get install byacc
$ sudo apt-get install libssl-dev
$ sudo apt-get install zlib1g-dev
$ sudo apt-get install libxml2-dev
$ sudo apt-get install subversion
$ sudo apt-get install libsvn-java
$ sudo apt-get install vim
※ 진행이 안되는 경우 'sudo apt-get update'로 저장소 정보를 다시 읽어 오거나, 시냅틱 패키지 관리자에서 저장소 위치를 변경해 본다. - java 우선순위 설정 (OpenJDK, Sun/OracleJDK 선택)
$ sudo update-alternatives --config java - eclipse.ini 추가 (Xms, Xmx 동일하게 두면 heap 확보를 위해 늘었다 줄었다 하지 않음)
-XX:MaxPermSize=256m
-Xms512m
-Xmx512m
-XX:PermSize=128m
-XX:+UseParallelGC
<파일 관리>
- 휴지통 호환 커맨드 라인 파일 삭제 도구: trash-cli (http://code.google.com/p/trash-cli/)
- rm에 해당하는 trash-put 을 실행하면 휴지통으로 파일을 이동시킨다.
- 노틸러스 휴지통과 호환된다. (FreeDesktop.org Trash 스펙을 구현했다)
- alias rm='/usr/local/bin/trash-put' 으로 설정해두고 쓰면 된다. rm 옵션과 호환성을 제공하며 -f 옵션은 무시된다. 무조건 휴지통으로 이동됨.
<원격데스크탑>
- FreeNX (권장)
http://www.nomachine.com/download.php - VNC, XRDP 설치
- sudo apt-get install vnc4server
- sudo apt-get install xrdp - [맥 OSX] CoRD: RDP 프로토콜을 지원하는 Free버전 RDP Client
- http://cord.sourceforge.net/ 에서 받아서 설치
- 참고: http://mcchae.egloos.com/10616767
<기타>
- audacious: 가벼운 mp3 플레이어 (winamp 스킨을 사용할 수 있음)
- 스킨은 usr/share/audacious/Skins/ 디렉토리에 풀어 놓기만 하면 됨. - XnViewMP: 이미지뷰어 (gwenview가 있으나 KDE용이라..)
http://hizoka.funcenter.fr/linux/XnViewMP_0.26_32.deb
http://hizoka.funcenter.fr/linux/XnViewMP_0.26_64.deb - pidgin 메신저: nateon plugin 사용 가능
- Adium 테마 플러그인 설치: http://www.webupd8.org/2009/11/adium-themes-in-pidgin-ubuntu-karmic.html - gui diff (http://meld.sourceforge.net/)
- sudo apt-get install meld - 바탕화면 가젯: screenlets
<우분투 Unity 제거>
- http://opensea.egloos.com/5693543
- 우분투 소프트웨어 센터에서 gnome-session-fallback과 indicator-appmenu-applet을 검색하여 설치 http://linux-software-news-tutorials.blogspot.kr/2011/10/ubuntu-1110-oneiric-remove-unity-and.html$ sudo apt-get remove unity unity-2d-places unity-2d unity-2d-panel unity-2d-spread unity-asset-pool unity-services unity-lens-files unity-lens-music unity-lens-applications gir1.2-unity-4.0 unity-common indicator-sound indicator-power indicator-appmenu libindicator6 indicator-application evolution-indicator indicator-datetime indicator-messages libnux-1.0-0
<11.10 이후 버전>
- synaptic package manager 설치.
- sudo apt-get install synaptic
<Nvidia 그래픽 카드 드라이버 설치>
(주의: 그래픽 카드는 기본 설치된 드라이버를 잡아주길 권장하며, 강제로 설치할 경우 아래 순서로)
- 그래픽 카드 확인
$ lspci |grep -i -e Display -e VGA - Nvidia 그래픽 카드 설치
- X를 종료한 후 터미널에서 작업
- nvidia 드라이버를 다운로드하여 설치하면 "Nouveau kernel driver"를 사용중이어서 설치할 수 없다고 에러를 뱉는다.
- $ sudo apt-get --purge remove xserver-xorg-video-nouveau 명령으로 nouveau 드라이버 제거
- $ sudo ./NVIDA-Linux-버전.run 을 실행. 만약 진행이 안된다면 다음과 같이 강제 설치.
- $ sudo ./NVIDA-Linux-버전.run -k $(uname -r) -f
- PC 재시작
- 부팅되면 하드웨어 드라이버 검색에서 NVIDIA 드라이버가 2개 뜨는데, (권장)으로 된것 말고 새로 설치된 것을 선택.
- "시스템 > 관리 > NVIDIA X Server Settings" 로 들어가서 원하는 대로 설정.
- X 종료
$ sudo /etc/init.d/gdm stop - X 시작
$ sudo /etc/init.d/gdm start - X 재설정
sudo dpkg-reconfigure xserver-xorg - 설정파일
/etc/X11/xorg.conf - 멀티 모니터 설정하기
- NVIDIA X Server Settings 실행
- root 권한으로 실행이 안되면 터미널에서 'sudo nvidia-settings'로 실행하면 된다.
- X Server Display Configuration -> Display -> Configure... 에서 "TwinView"를 선택한다.
- Make this the primary display for the X screen 체크
- Save to X Configuration File을 눌러 변경 내용을 저장한다. 이 때 Merge with existing file 은 끈다(체크 해제).
- 로그아웃 -> 로그인
CPU load 이해하기CPU load 이해하기
Posted at 2011. 4. 22. 14:11 | Posted in OS/Unix/Linux읽고 정리하기.