2016년 4월 6일 수요일

파일질라 FTP 서버 구성

http://rootblog.tistory.com/10

2016년 3월 14일 월요일

NTP 서버 설정

출처 : http://mrain7.egloos.com/2809854

Ntp 서버를이용한 윈도우 <-> 리눅스간의 시간 동기화.

테스트 환경.
-      Server : Windows 2008 R2
IP : 211.241.161.200
서비스 : Windows 2008 에서 기본적으로 제공하는 NTP service

-      Client : CentOS 5.5 64bit
IP : 10.1.2.205
서비스 : CentOS 5.5에서 기본적으로 제공하는 ntpd

비고 : server CentOS 둘다 ntp 서비스를 이용한 자동 동기화를 생각했으나 상호간에 통신은 가능하고 NTP 관련 패킷이 전송 되는 것 까지 확인했으나 시간이 동기화 하지 않는 문제가 발생하여 Crond를 이용한 동기화










1)    Windows 설정.
시작 -> 실행 -> regedit
HKLM/SYSTEM/CurrentControlSet/Services/W32Time/Parameters
LocalNTP : REG_DWORD : 1
SNTP 서버를 항상 실행.
해당 레지스트리 파일이 없을 경우 마우스 우클릭 -> 새로 만들기 -> DWORD


           HKLM/SYSTEM/CurrentControlSet/Services/W32Time/Config
AnnounceFlags : REG_DWORD :5
기본값은 a이며  값을 5 바꿀 경우 해당 서버가 신뢰할  있는 시간서버로 설정된다.



HKLM/SYSTEM/CurrentControlSet/Services/W32Time/TimeProviders/NtpServer
Enabled : REG_DWORD : 1
NTP server 활성화.

이후 방화벽을 사용할 경우 UTP 123port 확인하고 열어  .

W32time service 재시작.
시작 -> 실행 -> cmd
-       net stop w32time
-       net start w32time


2)      Linux 에서 확인  cron 설정.
Sync 확인.
[root@localhost~]# ntpdate 211.241.161.200
18 Jul 15:03:22ntpdate[29757]: adjust time server 211.241.161.200 offset -0.068003 sec

Date 확인.
[root@localhost ~]# date
Mon Jul 18 14:48:35 KST 2011

Cron 설정.
[root@localhost sbin]# crontab –e
0 12 * * * /usr/sbin/ntpdate [ntp serverip]
[root@localhost ~]# service crond restart
Stopping crond:                                           [  OK  ]
Starting crond:                                           [  OK  ]



3)    추가
-      Windows 간 동기화.
-       HKLM/SYSTEM/CurrentControlSet/Services/W32Time/TimeProviders/NtpClient
Enabled : DWORD : 1
Client service 시작.
-       HKLM/SYSTEM/CurrentControlSet/Services/W32Time/TimeProviders/NtpClient
SpecialPollInterval: REG_DWORD : 86400(10진수)
시간 동기화 주기 (초단위 86400  경우 하루 단위)








-       Linux동기화
/etc/ntp.conf 수정.

#Permit time synchronization with our time source, but do not
#permit the source to query or modify the service on this system.

restrictdefault nomodify notrap noquery
#restrictdefault kod nomodify notrap nopeer noquery
#restrict-6 default kod nomodify notrap nopeer noquery

#Permit all access over the loopback interface. This could
#be tightened as well, but to do so would effect some of
#the administrative functions.
restrict127.0.0.1
#restrict-6 ::1

#Hosts on local network are less restricted.
restrict211.241.161.0 mask 255.255.255.0 nomodify notrap noquery
#restrict192.168.1.0 mask 255.255.255.0 nomodify notrap

#Use public servers from the pool.ntp.org project.
#Please consider joining the pool (http://www.pool.ntp.org/join.html).

server211.241.161.200

#server0.centos.pool.ntp.org
#server1.centos.pool.ntp.org
#server2.centos.pool.ntp.org

#broadcast192.168.1.255 key 42         # broadcastserver
#broadcastclient                        # broadcast client
#broadcast224.0.1.1 key 42             # multicastserver
#multicastclient224.0.1.1              # multicast client
#manycastserver239.255.254.254         # manycast server
#manycastclient239.255.254.254 key 42  # manycast client

#Undisciplined Local Clock. This is a fake driver intended for backup
#and when no outside source of synchronized time is available.
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

#Drift file.  Put this in a directorywhich the daemon can write to.
#No symbolic links allowed, either, since the daemon updates the file
#by creating a temporary in the same directory and then rename()'ing
#it to the file.

driftfile/var/lib/ntp/drift
driftfile/etc/ntpd.drift

#Key file containing the keys and key identifiers used when operating
#with symmetric key cryptography.
keys/etc/ntp/keys

#Specify the key identifiers which are trusted.
#trustedkey4 8 42

#Specify the key identifier to use with the ntpdc utility.
#requestkey8

#Specify the key identifier to use with the ntpq utility.
#controlkey8

붉은색 부분 수정
restrictdefault nomodify notrap noquery
기본으로모든 권한을 주지는 않음을 의미한다.
restrict127.0.0.1
서버자신에 대해서는 모든 권한을 가진다.
. restrict 211.241.161.0 mask255.255.255.0 nomodify notrap noquery
의경우 server에서 해당 대역대 내의 장비들에 대해 ntp통신을허가하겠다는 의미.
server211.241.161.200
동기화할 대상 서버.



확인.
[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 61.110.197.50   133.100.9.2      2 u   60   64    1    6.606  19649.3   0.001
 maths.kaist.ac. 133.100.9.2      2 u   59   64    1    9.258  19646.7   0.001
118.219.234.251 216.171.124.36   2 u   58   64    1    5.311  19639.3   0.001

Refid 에 정상적인 ip가 나온다면 해당 서버로부터 정상적으로 동기화되고 있다는 의미다.

*)주의 할 점.
Ntpd 서비스가 올라가 있을 경우위에서 사용한 ntpdate 사용시 오류가 발생한다.
따라서 ntpd 또는 ntpdate를 동시에 사용 하는 것은 자제하도록 한다.


참조 

2016년 1월 11일 월요일

ubuntu usb disk

출처 : http://vulpecula.tistory.com/24

1. disk 정보 확인
sudo fdisk -l

-> disk 정보 출력

Disk /dev/sdb: 2000.4 GB, 2000398933504 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029167 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disk identifier: 0x08188266

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  3907024895  1953511424    7  HPFS/NTFS/exFAT

위는 2기가 NTFS 디스크임

2. 마운트 포인트 생성
sudo mkdir /media/extusb

3. usb disk 마운트
sudo mount -t ntfs-3g /dev/sdb1 /media/extusb

FAT 라면
sudo mount -t vfat /dev/sdb1 /media/extusb

usb disk에 한글이 깨져서 나오면 다음의 옵션 추가
sudo mount -t vfat /dev/sdb1 /media/extusb -o utf8

4. 언마운트
sudo umount /dev/sdb1

또는
sudo umount /media/extusb

2015년 9월 1일 화요일

우분투 Ubuntu vnc xfce4

vnc 상태를 xfce4로 연결하기
1. 편집 ./vnc/xstart
2. 아래와 같이
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xrdb $HOME/.Xresources
startxfce4 &

==================================
xfce 터미널 프롬프트 색 설정
출처 : http://yujuwon.tistory.com/entry/xfce-%ED%84%B0%EB%AF%B8%EB%84%90-%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8-%EB%B0%8F-%EC%9E%90%EB%8F%99%EC%99%84%EC%84%B1-%EC%84%A4%EC%A0%95

1. 터미널 - 메뉴 - 편집 - 프로파일
2. 편집 버튼 - 색 탭 - 시스템 테마 색 사용 체크박스 해제

==================================
xfce 터미널 프롬프트 탭 (Tab) 자동완성 설정
출처 : http://yujuwon.tistory.com/entry/xfce-%ED%84%B0%EB%AF%B8%EB%84%90-%ED%94%84%EB%A1%AC%ED%94%84%ED%8A%B8-%EB%B0%8F-%EC%9E%90%EB%8F%99%EC%99%84%EC%84%B1-%EC%84%A4%EC%A0%95

1. 편집 ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
2.  이 항목을
변경
3. 연결해제 후 재접속

2015년 8월 31일 월요일

우분투 vnc 설정, sudo 권한 주기, 우분투 버전 확인

sudo adduser 사용자계정 sudo
su 사용자계정
------=====================

우분투 vnc 설정 출처
http://blog.fun25.co.kr/ubuntu-14-04-gnome-desktop-%EB%B0%8F-vnc-%EC%84%A4%EC%B9%98/

gnome desktop 설치
# sudo apt-get install ubuntu-desktop

gnome panel 설치
# sudo apt-get install gnome-panel

vnc 서버 설치
# sudo apt-get install vnc4server

vnc 서버 시작
# vncserver -geometry 1920x1080 -depth 16
You will require a password to access your desktops.

Password:
Verify:

New 'geosr148:1 (delft3d)' desktop is geosr148:1

Creating default startup script /home/delft3d/.vnc/xstartup
Starting applications specified in /home/delft3d/.vnc/xstartup
Log file is /home/delft3d/.vnc/geosr148:1.log

~/.vnc/xstartup 편집
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
# x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# x-window-manager &

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus -n &
gnome-terminal &

$ sudo chmod +x ~/.vnc/xstartup

vnc 서버 종료 및 시작
$ vncserver -kill :1
Killing Xvnc4 process ID 22709

$ vncserver -geometry 1920x1080 -depth 16
New 'geosr148:1 (delft3d)' desktop is geosr148:1

Starting applications specified in /home/delft3d/.vnc/xstartup
Log file is /home/delft3d/.vnc/geosr148:1.log

클라이언트에서 접속하기
vnc 클라이언트에
IP:1
접속



-===========================
lsb_release -a

2015년 8월 27일 목요일

원격데스크탑연결로 Ubuntu 접속

Ubuntu 원격접속 (xrdp, vnc)
출처 http://whatwant.tistory.com/481

1. # sudo atp-get install xrdp
2. 윈도우 "원격 데스크톱 연결"
=============================

접속 후 바탕화면만 보이고 아무것도 안보일 경우
출처 : redsea23.tistory.com/320

gnome-panel 설치가 필요하다.
우분투 12 버전부터 이런 문제가 발생한듯.

1. # sudo apt-get install gnome-panel
2. $ echo "gnome-session --session=gnome-fallback" > ~/.xsession
3. # sudo service xrdp restart
==================================

d 키를 입력하면 바탕화면이 나타날때
출처 : auctionpro.co.kr/?p=2424

1. # sudo apt-get install compizconfig-settings-manager
2. 컴피즈 설정 관리자 실행 : 프로그램 위치 - 시스템도구 - 기본설정 - 컴피즈설정관리자
3. 일반설정
4. 키 바로가기 탭
5. 바탕화면보기 : 사용하지 않음 또는 Z 등으로 변경
6. 재접속


윈도우에서 우분투로 접속할라니까...

xrdp_mm_process_login_response: login failed

이러면서 연결이 안된다면!!
출처 : http://zzinggu.egloos.com/3082933


 http://linuxtoolkit.blogspot.sg/2013/03/xrdpmmprocessloginresponse-login-failed.html
이렇게 세션을 다 날리는 방법으로 해서 되긴한데..
이건 좀..걍 임시 방편같고...


난 더 확실하게!! 날리고 새로 깔고 시작 ㅎㅎ
#sudo apt-get remove xrdp

#sudo vi /etc/xrdp/xrdp.ini 에서 [globals]에 3389 port가 되어있나 확인만~

#sudo vi /etc/xrdp/sesman.ini에 
[Security]
AllowRootLogin=1
MaxLoginRetry=4
#TerminalServerUsers=tsusers
#TerminalServerAdmins=tsadmins

[Sessions]
X11DisplayOffset=10
MaxSessions=100
KillDisconnected=0
IdleTimeLimit=0
DisconnectedTimeLimit=0

이렇게~~ 해주고
#service xrdp restart

쫜!!

maxsession의 문제로 인해서 발생되는 경우가 대부분이라 maxsession의 수를 늘려주는듯!
그래서 첨의 링크에서 session 정보를 지우는 방식을 권하지 않은 것!

2015년 1월 7일 수요일

.NET framework install on Windows Server 2012 R2

윈도우 2012 R2 CD를 넣은 후 아래의 명령 실행

dism /online /enable-feature /featurename:NetFX3 /all /Source:d:\sources\sxs /LimitAccess

Add-WindowsFeature NET-Framework-Core -Source d:\sources\sxs

AIX vnc 설정 및 접속

출처 http://hermestop.tistory.com/123

1. RPM 패키지 다운로드
ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/vnc/
vnc-3.3.3r2-6.aix5.1.ppc.rpm 다운로드

2. root 권한으로 패키지 설치
rpm -Uvh vnc-3.3.3r2-6.aix5.1.ppc.rpm
설치디렉토리는 /opt/freeware/bin

3. vncserver를 설정할 계정으로 로그인 후
vncserver 명령어 입력

password를 두번 입력한다.

New 'X' desktop is ~~~ :1 이것은 vncserver가 1번 터미널로 설정되었다는 의미

4. 정보 확인
~/.vnc 디렉토리에 4개의 파일이 생성됨

5. log 파일 확인
hostname:1.log 파일을 보면
TCP port 5901은 vnc viewer 접속용이고,
TCP port 5801은 http 접속용임

6. vnc viewer를 통한 접속
사용하고 있는 vnc viewer에
ip:5091
password 입력

7. 접속 완료
기본적인 xterm이 표현됨

8. DT 환경 설정
~/.vnc/xstartup 편집

xrdb ~~ 를 제외한 아래쪽 줄은 주석 # 처리 후
아래의 내용 추가
/usr/dt/bin/dtsession &


9. vncserver 재가동
vncserver -kill :1

vncserver

다시 접속. 끝.

2014년 3월 5일 수요일

AIX Customizing

1. 자동완성기능 (bash의 tab 기능)
.profile 편집

EDITOR=emacs; export EDITOR
: esc 두번 누르면 자동완성
: esc 한번 누르고 = 누르면 목록나옴.


2. prompt
.profile 편집

PS1="$(whoami)@$(hostname)(\$PWD)$ "
export PS1

3. alias
.profile 편집

alias l='ls -l'
alias la='ls -a'
alias ll='ls -al'

4. AIX 버전 확인
uname -a
oslevel

5. java 환경설정
.profile 편집

export JAVA_COMPILER=/usr/java6/bin/javac
export JAVA_HOME=/usr/java6

export PATH=/usr/java6/bin:usr/java6/jre/bin:$PATH

6. AIX에 bash 설치
bash 다운로드
http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html

bash-4.2-1.aix6.1.ppc.rpm 다운로드 (2014. 3. 7 기준)

root계정으로 /tmp에 파일 업로드후 인스톨
rpm --install bash-4.2-1.aix6.1.ppc.rpm

/etc/shells 편집
맨 아래에 /usr/bin/bash 추가

/etc/security/login.cfg 편집
shells= 항목 제일 뒤에 /usr/bin/bash 추가

7. java 64bit 설치
http://existence.tistory.com/73 참조
aix download and service information 페이지에서 파일을 다운로드 받는다.

Java6_64.sdk는 필수

받은 파일을 /tmp에 업로드 함

설치 명령:
installp_r -a -Y -d '.' Java6_64.sdk
제거 명령:
installp_r -u -R [설치디렉토리] Java6_64.sdk
설치 후, 정상 동작을 위한 명령어셋:
unset LIBPATH
unset CLASSPATH
unset JAVA_COMPILER
unset JAVA_HOME
export PATH=/usr/java6_64/jre/bin:/usr/java6_64/bin:$PATH
을 실행하여 기존 JDK5에 관련된 것을 제거하고 JDK6 경로를 먼저 넣어준다. 그런 후,
java -version
를 실행하여 다음 아웃풋을 확인하면 된다:
java version "1.6.0"
Java(TM) SE Runtime Environment (build pap6460-20071123_01)
IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 AIX ppc64-64 jvmap6460-20071121_15015 (JIT enabled)
J9VM - 20071121_015015_BHdSMr
JIT - r9_20071121_1330
GC - 20071031_AA)
JCL - 20071118_01
이런 상태에서 tomcat을 구동하고, JVM 버전을 보면 2.4로 출력된다.

8. DNS 설정
root계정에서 /etc/resolv.conf 편집

nameserver    000.000.000.000
저장

refresh -s inetd

2014년 3월 4일 화요일

vi 기본 설정

~/.vimrc 편집

set autoindent
set cindent
set smartindent
set number
set tabstop=4
set shiftwidth=4

2013년 11월 21일 목요일

wget으로 다운로드

# wget -r ftp://192.168.0.231/iwf/

      -r 옵션은 하위폴더 까지 모두 다운

# wget -r ftp://dari88:password@192.168.0.231/iwf/

     패쓰워드 걸려있는 ftp 다운.

     파일 하나하나 받을려면 경로아래 파일이름 써주면 끝 -

물론 그냥 ftp> 접속해서 파일단위로 받아도 관계없음
출처 : http://alaveiw.tistory.com/entry/wget%EC%9C%BC%EB%A1%9C-ftp-%EB%8B%A4%EC%9A%B4%EB%B0%9B%EA%B8%B0


http도 마찬가지 방법을 사용할 수 있음

2013년 5월 29일 수요일

Virtual Box 공유폴더 (ubuntu12.10)

1. 게스트확장 설치
2. [장치] - [공유 폴더] 임시폴더에 공유할 디렉토리 지정
3. 우분투 재부팅
4. 디렉토리 생성 (windows)

sudo mount -t vboxsf windows ~/windows

2013년 4월 9일 화요일

리눅스 32비트, 64비트 구분

1. getconf LONG_BIT
32  # 32비트
64  # 64비트

2. uname -i
i686 # 32비트
x86_64 # 64비트

2013년 4월 8일 월요일

virtualbox 공유폴더

http://blog.naver.com/virus127?Redirect=Log&logNo=150030818328

내꺼 마운트
sudo mount -t vboxsf share /mnt/share/

Virtualbox

[파일] - [환경설정] -- [입력] - [호스트키]
기본적으로 ctl로 설정되어있는데 이를 잘 안쓰는 f11이나 f12등으로 변경

시작된 VBox의 버추얼 머신에서 
[장치] - [게스트 확장 설치]
이렇게 하면 마우스 휠도 쓰고 모니터 해상도도 자동으로 변환됨

2013년 3월 6일 수요일

ps 파일을 gif로

#!/usr/bin/csh
foreach psfl (*.ps)

echo $psfl

convert -crop 0x0 -density 130 ${psfl} ${psfl}.gif
end

2012년 11월 7일 수요일

zypper install 안될 때

zypper install 패키지명 할 경우 설치가 안될 때가 있음

Failed to mount cd:///?devices=/dev/sr0  이런 말이 나오면서.

그러면
zypper mr --disable 1 

다시 설치하면 됨.

linux 모든 사용자 PATH

root 권한
/etc/skel 의 .bashrc 또는 .bash_profile 에서 path를 지정하면 새로 생기는 계정은 모두 동일 path 설정
즉, 계정 추가시의 template 역할을 함

이미 있는 계정의 경우
/etc/profile에서 PATH 관련 부분을 편집하면 모든 사용자의 PATH가 적용됨

시스템 관리자는 반드시 필요한 PATH를 /etc/skel/.bashrc 또는 .bash_profile 과 /etc/profile 파일에서 편집할 것

2012년 11월 2일 금요일

opensuse ftp

zypper install vsftpd
질문에 y

http://plusblog.tistory.com/416 참조
vi /etc/vsftpd.conf

여기서 아래의 세군데의 주석을 해제 하시고, 다음과 같이 세팅을 해줍니다.
==================== 편집기 ======================
anonymous_enable=NO
local_enable=YES
write_enable=YES
=================================================


데몬 시작
/etc/init.d/vsftpd restart

opensuse telnet

출처 : http://soldatj.blog.me/10093017714

root 로그인
zypper install telnet-server
질문 나오면 y
설치완료

vi /etc/xinetd.d/telnet
여기에서 disable = yes를 no로 수정

서비스 재시작
service xinetd restart

이제 접속 가능