wiki/ssh.myco

46 lines
2.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

= Permission denied (publickey)
Mengutip dari salah satu [[https://askubuntu.com/a/16665 | jawaban]] di AskUbuntu, SSH sangat pilih-pilih terhadap permisi folder `.ssh` dan file `authorized_keys`.
```
sudo chown -R username:username /home/username/.ssh
sudo chmod 0700 /home/username/.ssh
sudo chmod 0600 /home/username/.ssh/authorized_keys
```
= Menyalin kunci ke peladen
Dari manual ssh-copy-id:
```
NAME
ssh-copy-id — use locally available keys to authorise logins on a remote machine
SYNOPSIS
ssh-copy-id [-f] [-n] [-s] [-i [identity_file]] [-p port] [-o ssh_option] [user@]hostname
ssh-copy-id -h | -?
DESCRIPTION
ssh-copy-id is a script that uses ssh(1) to log into a remote machine (presumably using a login password, so password authentication should be enabled, unless you've done some
clever use of multiple identities). It assembles a list of one or more fingerprints (as described below) and tries to log in with each key, to see if any of them are already in
stalled (of course, if you are not using ssh-agent(1) this may result in you being repeatedly prompted for pass-phrases). It then assembles a list of those that failed to log
in, and using ssh, enables logins with those keys on the remote server. By default it adds the keys by appending them to the remote user's ~/.ssh/authorized_keys (creating the
file, and directory, if necessary). It is also capable of detecting if the remote system is a NetScreen, and using its set ssh pka-dsa key ... command instead.
```
Skrip ini menginstal kunci SSH pada server sebagai kunci resmi. Tujuannya adalah untuk menyediakan akses tanpa memerlukan kata sandi untuk setiap login. Hal ini memfasilitasi login otomatis tanpa kata sandi dan sistem masuk tunggal menggunakan protokol SSH.
```
ssh-copy-id -i ~/.ssh/mykey user@host
```
= SSH Tunnel
Secure Shell (SSH) Tunnel terdiri dari sebuah "terowongan" terenkripsi yang dibuat melalui koneksi protokol SSH. Pengguna dapat mengatur terowongan SSH untuk mentransfer lalu lintas yang tidak dienkripsi melalui jaringan melalui saluran terenkripsi.
```
ssh -N -L 8080:127.0.0.1:destinationport username@hostname
```
= SFTP
//Lebih lanjut: [[./SFTP]]//
SFTP merupakan alat yang memungkinkan transfer file melalui protokol SSH. Ini merupakan ekstensi dari protokol SSH dan dianggap sebagai penerus dari [[FTP]]/[[FTP | FTPS]] karena beberapa kelebihan dari segi keamanan dibandingkan FTP dan FTPS.
Beberapa kelebihan SFTP dibandingkan FTP/FTPS:
* Hanya perlu membuka satu port (umumnya port 22).
* Tidak membutuhkan kata sandi. SFTP dapat dikonfigurasi agar hanya menggunakan kunci SSH sebagai alih-alih autentikasi berbasis kata sandi.
* Dukungan 2FA menggunakan TOTP