OpenSSH(Open Secure SHell) > 개발자팁

개발자팁

개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.

OpenSSH(Open Secure SHell) 정보

기타 OpenSSH(Open Secure SHell)

본문

OpenSSH(Open Secure SHell)

29.1 설치

29.1.1 설치 확인
[root @edu00 linux]#rpm -qa | grep openssh
openssh-*
openssh-askpass*
openssh-server*
openssh-clients*
openssh-askpass-gnome*

29.1.2 설정 파일 확인
[root @edu00 linux]#ls /etc/ssh
primes ssh_config ssh_host_dsa_key ssh_host_dsa_key.pub 
ssh_host_key ssh_host_key.pub ssh_host_rsa_key ssh_host_rsa_key.pub 
sshd_config

29.1.3 환경 설정 파일
환경설정 파일은 /etc/ssh 디렉토리
설정 파일은 ssh_config(클라이언트), sshd_config(서버)

29.1.4 서버 설정
[root @edu00 linux]#cd /etc/ssh
[root @edu00 ssh]#vi sshd_config
--------------------------------------------------------------------
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# This is the sshd server system-wide configuration file.  See sshd(8)  for more
information.
Port 22    <- 다른 데몬의 포트와 중복되어서는 안된다.
Protocol 2,1    <- 우선순위는 2

 


ListenAddress 0.0.0.0   <- 허용 IP, 모든 IP
#ListenAddress ::
HostKey /etc/ssh/ssh_host_key  <- hostkey 파일의 절대경로, 암호
해독할 key값
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
ServerKeyBits 768
LoginGraceTime 600   <- lonin 시간을 설정
KeyRegenerationInterval 3600
PermitRootLogin yes   <- root login 허용
#
# Don't read ~/.rhosts and ~/.shosts files
IgnoreRhosts yes   <- 원격접속 불허(rcp, rlogin..)
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
StrictModes yes
X11Forwarding yes   <- X-window용 프로그램 실행 가능
X11DisplayOffset 10
PrintMotd yes
KeepAlive yes

# Logging
SyslogFacility AUTHPRIV
LogLevel INFO
# obsoletes QuietMode and FascistLogging

RhostsAuthentication no
#
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
RhostsRSAAuthentication no
#
RSAAuthentication yes

 


# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
PermitEmptyPasswords no  <- Null password를 가진 계정은 접속 불허

# Comment to enable s/key passwords or PAM interactive authentication
# NB. Neither of these are compiled in by default. Please read the
# notes in the sshd(8) manpage before enabling this on a PAM system.
#ChallengeResponseAuthentication no
#SkeyAuthentication no
KbdInteractiveAuthentication yes

# To change Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#AFSTokenPassing no
#KerberosTicketCleanup no

# Kerberos TGT Passing does only work with the AFS kaserver
#KerberosTgtPassing yes

CheckMail yes  <- ssh로 접속했을 때 메일 유무 확인
#UseLogin no

MaxStartups 10:30:60
#Banner /etc/issue.net
#ReverseMappingCheck yes
Subsystem  sftp /usr/libexec/openssh/sftp-server

29.1.5 사용
#ssh 192.168.1.1 <- 옵션이 없으면 local 사용자 계정으로 접속, local에 root로
 접속되었다면 root로 접속
#ssh webmaster@192.168.1.1

 


29.2 Secure ftp (sftp)
29.2.1  site:www.ssh.com

29.2.2 설정 확인
[root @edu00 linux]#vi /etc/ssh/sshd_config
Subsystem sftp /usr/libexec/openssh/sftp-server
MaxStartups 10:30:60
[root @edu00 linux]#/etc/rc.d/init.d/sshd restart

29.2.3 sftp 클라이언트 설치
[root @edu00 linux]#rpm -Uvh sftp*.rpm

29.2.4 실행
[root @edu00 linux]#sftp 192.168.1.1
root@192.168.1.1's password:
sftp>

29.3 SCP (Secure CoPy)
패킷을 암호화해서 송수신

29.3.1  Client의 파일을 Server로 copy하는 경우  -- FTP의 Upload
[root @edu00 linux]#scp -p /home/linux/a.txt 192.168.1.1:/root
root@192.168.1.1's password:
a.txt 100% |********************************************************| 23 00:00
[root @edu00 linux]#scp -pr /home/linux 192.168.1.1:/root
: -r 옵션은  디렉토리를 포함하여 copy한다.

29.3.2  Client에서 Server에 있는 파일을 복사해오는 경우 -- FTP의 Download
[root @edu00 linux]#scp -pr 192.168.1.1:/home/linux/b* /home
root@192.168.1.1's password:
b.txt  100% |*******************************************************| 23 00:00
: 원격 서버(192.168.1.1)의 /home/linux 디렉토리 하위를 대상으로 b로 시작하는 모든

 


파일이나 디렉토리를 /home으로 복사

[root @edu00 linux]#scp -pr * 192.168.1.1:/home
: 현재 디렉토리의 파일 및 하위 디렉토리를 192.168.1.1 서버의 /home으로 모두 복사
 

[이 게시물은 관리자님에 의해 2011-10-31 17:32:05 Linux에서 이동 됨]
추천
1

댓글 1개

전체 30
개발자팁 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT