Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== SSH (Secure Shell) ====== SSH (Secure Shell) adalah protokol jaringan yang digunakan untuk komunikasi aman antar komputer. Semua data yang dikirim melalui SSH dienkripsi sehingga terlindungi dari penyadapan maupun serangan. SSH banyak dipakai untuk: * Mengelola server jarak jauh * Transfer file dengan aman * Membuat koneksi terenkripsi di jaringan publik ---- ===== Instalasi SSH Server (Ubuntu/Debian) ===== <code bash> sudo apt update sudo apt install openssh-server </code> === Mengecek status service === <code bash> systemctl status ssh </code> Output normalnya akan menunjukkan service **active (running)**. === Lokasi file konfigurasi utama === <code> /etc/ssh/sshd_config /etc/ssh/sshd_config.d/ </code> ---- ===== Menggunakan SSH ===== === Koneksi ke server === <code bash> # Default port (22) ssh user@192.168.1.5 # Dengan port tertentu ssh user@192.168.1.5 -p 6222 </code> === Menjalankan perintah langsung === <code bash> # Menjalankan perintah di server ssh user@192.168.1.5 'ls -l' # Menjalankan script lokal di server ssh user@192.168.1.5 bash < script.sh # Kompres dan unduh file/folder dari server ssh user@192.168.1.5 "tar czf - ~/source" > output.tgz </code> ---- ===== Transfer File dengan SCP ===== <code bash> # Copy dari remote ke local scp user@server:/dir/file.ext ./dest/ # Copy dari local ke remote scp ./file.ext user@server:/dir/ # Copy folder (rekursif) scp -r user@server:/dir ./dest/ # Copy antar remote server scp user@server1:/file user@server2:/dir # Copy semua isi folder scp user@server:/dir/* ./ </code> ---- ===== SSH Key ===== SSH Key memudahkan login tanpa password dengan sistem **public/private key**. === Membuat SSH Key === <code bash> # RSA 4096 bit ssh-keygen -t rsa -b 4096 -C "your@mail.com" # Ed25519 (lebih modern & ringan) ssh-keygen -t ed25519 -C "comment's key" # Interaktif default ssh-keygen # Tentukan nama file key ssh-keygen -f ~/.ssh/custom_key </code> === Operasi tambahan === <code bash> # Buat public key dari private key ssh-keygen -y -f private.key > public.pub # Ubah komentar key ssh-keygen -c -f ~/.ssh/id_rsa # Ubah passphrase private key ssh-keygen -p -f ~/.ssh/id_rsa </code> === Menyalin key ke server === <code bash> ssh-copy-id user@server # Menyalin key tertentu ssh-copy-id -i ~/.ssh/id_rsa.pub user@server </code> ==== Jenis Key ==== * rsa * ed25519 * dsa (lama, jarang dipakai) * ecdsa ==== Format Key ==== * PEM * PKCS8 ---- ===== File Konfigurasi SSH ===== ^ Path ^ Deskripsi | | /etc/ssh/ssh_config | Konfigurasi global (client) | | ~/.ssh/config | Konfigurasi user (client) | | ~/.ssh/id_{type} | Private key | | ~/.ssh/id_{type}.pub | Public key | | ~/.ssh/known_hosts | Daftar host yang dikenal | | ~/.ssh/authorized_keys | Public key yang diizinkan | ---- ===== Contoh Konfigurasi ~/.ssh/config ===== <code> # Opsi global ForwardAgent yes ServerAliveInterval 60 Compression yes # Host tertentu Host example.com HostName example.com User username Port 22 IdentityFile ~/.ssh/id_rsa # ProxyJump jump.example.com # Gunakan bastion/jump host # Alias untuk koneksi cepat Host server1 HostName 192.168.1.10 User admin Port 2222 IdentityFile ~/.ssh/id_ed25519 </code> === Menggunakan alias === <code bash> ssh server1 </code> system/linux/ssh.txt Last modified: 2026/02/01 21:08by 127.0.0.1