SFTP Nedir ve Nasıl Kullanılır?

Emre Emanet
3 min readApr 13, 2022

--

Dosyaların bir bilgisayardan diğerine aktarılması, bir ağ veya internet çalışma ortamından beklenen görevlerden birisidir. File Transfer Protocol (FTP), TCP / IP tarafından sağlanan standart mekanizmadır. FTP ile internete bağlı bir bilgisayardan diğerine (her iki yönde) dosya aktarımı yapılabilir. Ancak FTP güvenli bir bağlantı mekanizması değildir. Saldırıların hedefi olabilmektedir.

SFTP ise SSH üzerinden güvenli bir şekilde dosya aktarımı yapan protokoldür. SFTP sadece dosya aktarmakla kalmaz, dizin listeleme, dizin oluşturma, dizin ve dosya silme, dizinleri yeniden isimlendirme gibi özellikleri de bünyesinde barındırır.

SFTP Bağlantısı Kurmak:

SFTP bağlantısı kurulacak sunucunun IP adresi ve kullanıcı adı bilgisi önemlidir. Bağlantı kurulurken Windows’ta da Linux’ta da aynı mantık ile bağlantı kurulur.

sftp kullanıcıadı@ipadresi

Linux Örneği:

[root@syslog~]# sftp emre@10.10.137.6
Connecting to 10.10.137.6... emre@10.10.137.6's password: sftp>

Windows Örneği:

C:\Users\emanet>sftp emanet@10.86.36.174
Authorized uses only. All activity may be monitored and reported.
Password:
Connected to emanet@10.86.36.174.
sftp>

Sık Kullanılan SFTP Komutları

pwd komutu uzak sunucunun o anda çalıştığı dizini ekrana yazdırır.

sftp> pwd
Remote working directory: /home/emre

lpwd komutu kendi makinenizde o anda çalıştığı dizini ekrana yazdırır.

sftp> lpwd
Local working directory: c:\users\eemanet

cd komutu uzak sunucunun dizinini değiştirir.

sftp> cd /

lcd komutu kendi makinenizde bulunduğunuz dizini değiştirir.

sftp> lcd C:/EMRE

ls komutu uzak sunucunun içindeki dosyaları listeler.

sftp> ls
95 deneme.txt emre.txt local.cshrc local.login local.profile sysdate-90

lls komutu makinenizin içindeki dosyaları listeler.

sftp> lls
Volume in drive C is Windows
Volume Serial Number is 50EB-7BD2

Directory of C:\EMRE

02.04.2022 02:42 <DIR> .
02.04.2022 02:42 <DIR> ..
07.04.2022 19:19 <DIR> Dokuman.doc
02.04.2022 02:42 0 deneme.txt
1 File(s) 0 bytes
6 Dir(s) 159.377.932.288 bytes free

put komutu dosya yükler (upload)

sftp> put deneme.txt
Uploading deneme.txt to /export/home/emre/deneme.txt
deneme.txt

get komutu dosya indirir (download)

sftp> get emre.txt
Fetching /export/home/emre/deneme.txt to deneme.txt
/export/home/emre/deneme.txt 100% 12 0.4KB/s 00:00

SFTP Komutları

sftp> help
Available commands:
bye Quit sftp
cd path Change remote directory to 'path'
chgrp grp path Change group of file 'path' to 'grp'
chmod mode path Change permissions of file 'path' to 'mode'
chown own path Change owner of file 'path' to 'own'
df [-hi] [path] Display statistics for current directory or
filesystem containing 'path'
exit Quit sftp
get [-afPpRr] remote [local] Download file
reget [-fPpRr] remote [local] Resume download file
reput [-fPpRr] [local] remote Resume upload file
help Display this help text
lcd path Change local directory to 'path'
lls [ls-options [path]] Display local directory listing
lmkdir path Create local directory
ln [-s] oldpath newpath Link remote file (-s for symlink)
lpwd Print local working directory
ls [-1afhlnrSt] [path] Display remote directory listing
lumask umask Set local umask to 'umask'
mkdir path Create remote directory
progress Toggle display of progress meter
put [-afPpRr] local [remote] Upload file
pwd Display remote working directory
quit Quit sftp
rename oldpath newpath Rename remote file
rm path Delete remote file
rmdir path Remove remote directory
symlink oldpath newpath Symlink remote file
version Show SFTP version
!command Execute 'command' in local shell
! Escape to local shell
? Synonym for help
sftp>

--

--

Responses (1)