-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01.ssh
68 lines (53 loc) · 1.28 KB
/
01.ssh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Public / Private Key Authentication
** public key stored on server
** private key stored locally
Server:
- cd
- mkdir .ssh
- exit
Client:
- ssh-keygen -b 4096 rsa
- cd .ssh (nereye kayıt ettiysen)
id_rsa id_rsa.pub known_hosts
- cd
- scp .ssh/id_rsa.pub emre@ip:/home/emre/.ssh
Server:
- cd .ssh/
- ls
id_rsa.pub
- mv id_rsa.pub authorized_keys
- chmod 400 authorized_keys
- (check .ssh file permission is 700)
- sudo chattr +1 authorized_keys
- cd /etc/ssh
- sudo vi sshd_config
and open file uncomment AuthorizedKyesFile %h/.ssh/authorized_keys
PasswordAuthentication yes to no
For Ubuntu 18.04
AuthorizedKyesFile .ssh/authorized_keys .ssh/authorized_keys2
AuthorizedKyesFile %h/.ssh/authorized_keys .ssh/authorized_keys2
PasswordAuthentication yes to no
- sudo systemctl restart ssh
# Permission denied (publickey) Hatası Alınırsa,
- ssh -i .ssh/id_rsa emre@ip
Client
- cd ~/.ssh
- vi config
Host nginx
HostName 35.236.64.179
User emre
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 60
ServerAliveCountMax 120
- ssh nginx
# Firewall Configs (server)
- sudo ufw status verbose
- sudo vi /etc/default/ufw
IPV6=yes to no
- sudo ufw default deny incoming
- sudo ufw default allow outgoing
- sudo ufw allow http
- sudo ufw allow https
- sudo ufw enable
- sudo ufw status
- sudo reboot