The Pursuit of Happyness

반응형
이 포스트는 아래 링크에 있는 자료를 요약한 자료 입니다.

http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/ 



ssh-keygen 과 ssh-copy-id 를 이용하면  패스워드를 입력하지 않고 리눅스 서버에 접속할수 있습니다.

ssh-keygen 은 public / private 키를 생성하는 명령어이고,

ssh-copy-id 는 로컬 호스트에 있는 public 키를 원격 서버에 있는 인증된 키를 저장하는 파일 (authorized_keys)  에 추가해 주는 명령어 입니다.

ssh-copy-id 는 원격 호스트의 홈 폴더에 있는 ~/.ssh 폴더, ~/.ssh/ authorized_keys 파일에 적절한 권한을 부여해줍니다.


1 단계 로컬호스트에서 ssh-key-gen 을 이용하여 public / private 키를 생성하기

userid@local-host$ [Note: You are on local-host here]

userid@local-host$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/userid/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/userid/.ssh/id_rsa.
Your public key has been saved in /home/userid/.ssh/id_rsa.pub.
The key fingerprint is:
73:b4:ee:aa:b5:c5:d8:e1:f1:a5:1e:26:5f:2f:53:9f userid@local-host

2 단계 ssh-copy-id 를 이용해서 원격 서버로 public 키를 복사하기

userid@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
userid@remote-host's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.
Note: ssh-copy-id 는 원격 서버에 있는 .ssh/authorized_key 에 public 키를 추가해 주는 작업입니다.


3단계 패스워드없이 원격서버에 로그인하기

userid@local-host$ ssh remote-host
Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2
[Note: SSH did not ask for password.]

userid@remote-host$ [Note: You are on remote-host here]

정리를 해 보면 서버1에서 서버2에 접속하기 위해서는 서버1에서 공용키를 생성해서 서버2에 복사해서 인증을 해 두어야 한다는 것입니다.

맥에서는 ssh-copy-id 라는 명령어가 없기 때문에 ssh-copy-id 에 해당하는 부분은 수동으로 설정을 해야 합니다.

방법은 서버1에서 ssh-keygen 으로 생성한 ~/.ssh/id_rsa.pub 파일을 서버2로 보냅니다. 

scp ~/.ssh/id_rsa.pub remote-host:home/userid

서버2에 로그인 하여, 다음의 명령어를 이용하여 public 키를 추가합니다.

cat ~/id_rsa.pub >> ~/.ssh/authorized_key



반응형

반응형
서비스 목록 보기
chkconfig --list

부팅시 서비스가 자동으로 실행되게 하기
chkconfig [서비스명] on

부팅시 서비스가 자동으로 실행되지 않게 하기
chkconfig [서비스명] off

ex)
chkconfig httpd on
chkconfig httpd off

참고로 부팅 레벨에 따라서 서비스 실행여부를 자세히 설정할 수도 있다.



 
반응형

반응형

sudo dmidecode --type 17

관련 링크
http://www.cyberciti.biz/faq/check-ram-speed-linux/  

dmidecode 가 설치되어 있지 않은 경우는 아래 명령을 이용하여 설치할 수 있다.

yum install dmidecode 

 
반응형

반응형
먼저 .svn 폴더가 있는지를 확인하는 방법
>> find . -type d -name .svn 

다음의 명령어를 통해 모든  .svn 폴더를 삭제할 수 있음
>> find . -type d -name .svn | xargs rm -rf




 
반응형

반응형

@ 부팅할때 생기는 로그 확인하기

> dmesg 


@ 시스템 종료하기

> init 0
> shutdown -h -time 0 
> shutdown -r -time 0  (reboot)


@ 환경설정하기

> setup 


@ 네트워크 관리

> cd /etc/sysconfig/network-scripts/
> ifup eth0
> ifdown eth0 
> service network restart 

> cd /etc/sysconfig/network-scripts/
> vi ifcfg-eth0
# Xen Virtual Ethernet
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.167.255
HWADDR=7e:4c:b0:e1:2e:xx
IPADDR=192.168.167.x
NETMASK=255.255.255.0
NETWORK=192.168.167.0
ONBOOT=yes

> cd /etc/sysconfig/
> vi network
GATEWAY=192.168.167.1


@ DNS 세팅 

> vi /etc/resolv.conf

nameserver 4.2.2.1
nameserver 4.2.2.2


@ 부팅할때 실행할 서비스 관리

> ntsysv 


반응형

반응형
vi /etc/resolv.conf

nameserver 4.2.2.1
nameserver 4.2.2.2


반응형

반응형
echo "mail content" | mail -s "mail title" tistory@email.com
 
반응형

반응형

crontab -e

m h d M y [command]

#every minute
* * * * * [command]

#every hour (0 minute)
0 * * * * [command]

#@ time (12:00)
0 12 * * * [command]


반응형