# 리눅스에서(centos) RSA/DSA 키와 함께 sftp 사용하기
sftp에 접속 후 대화형 sftp 명령어는 하단에 있음
일반적으로 키 파일을 사용하여 접속할땐 -i 옵션을 활용하면 된다.
sftp -i {/path/keyfile} {USER}@{HOST}
sftp -i key.pem user@s-abe6c967rtdssfsfb.server.transfer.us-east-1.amazonaws.com
만약 -i 옵션을 사용할 수 없다면 -o 옵션을 사용하면 된다.
sftp -oIdentityFile={/path/keyfile} {USER}@{HOST}
sftp -oIdentityFile=key.pem user@s-abe6c967rtdssfsfb.server.transfer.us-east-1.amazonaws.com
특정 포트로 접속하는 경우 옵션
sftp -oPort=22222 -oIdentityFile=key.pem user@s-abe6c967rtdssfsfb.server.transfer.us-east-1.amazonaws.com
-o 옵션 정리
AddressFamily
BatchMode
BindAddress
ChallengeResponseAuthentication
CheckHostIP
Cipher
Ciphers
Compression
CompressionLevel
ConnectionAttempts
ConnectTimeout
ControlMaster
ControlPath
GlobalKnownHostsFile
GSSAPIAuthentication
GSSAPIDelegateCredentials
HashKnownHosts
Host
HostbasedAuthentication
HostKeyAlgorithms
HostKeyAlias
HostName
IdentityFile
IdentitiesOnly
KbdInteractiveDevices
LogLevel
MACs
NoHostAuthenticationForLocalhost
NumberOfPasswordPrompts
PasswordAuthentication
PKCS11Provider
Port
PreferredAuthentications
Protocol
ProxyCommand
PubkeyAuthentication
RekeyLimit
RhostsRSAAuthentication
RSAAuthentication
SendEnv
ServerAliveInterval
ServerAliveCountMax
StrictHostKeyChecking
TCPKeepAlive
UsePrivilegedPort
User
UserKnownHostsFile
VerifyHostKeyDNS
원격호스트에 접속 후 사용할 수 있는 sftp 명령어
ls : 파일 리스트
pwd : 원격호스트 디렉토리 경로
lpwd : 로컬호스트 디렉토리 경로
mkdir upload : 원격호스트 디렉토리 생성
put -r 디렉토리 : 로컬호스트의 디렉토리 업로드 (원격 호스트에 동일한 디렉토리가 있어야 함)
put -pr 디렉토리 : 전송한 파일의 수정 시간, 엑세스 시간 및 모드를 보존하려면 -p 옵션을 활용
get -r 디렉토리 : 원격호스트의 디렉토리를 로컬호스트로 다운로드