Hieronder dan toch maar even alle stappen die ik doorlopen heb.
Ingelogd met putty met user music met alleen passw authorisatie
Protocol version 2 key generation
Ingelogd als User: music
directory /home/music/.ssh
Bijzonderheden: password ingevoerd bij passphrase
code:
1
2
3
4
5
6
7
8
9
10
| music@Debian:~/.ssh$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/music/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/music/.ssh/id_dsa.
Your public key has been saved in /home/music/.ssh/id_dsa.pub.
The key fingerprint is:
58:8d:1b:84:d2:bla bla::7b:ae:51:24 music@Debian
music@Debian:~/.ssh$ |
Keys in /home/music/.ssh
code:
1
2
| -rw------- 1 music music 736 Feb 19 21:49 id_dsa
-rw-r--r-- 1 music music 602 Feb 19 21:49 id_dsa.pub |
Het bestand id_dsa bevat mijn versie 2 private key
Het bestand id_dsa.pub bevat mijn versie 2 public key
Authorized_keys2, /home/music/.ssh
code:
1
2
3
4
5
6
7
8
| music@Debian:~/.ssh$ touch authorized_keys2
music@Debian:~/.ssh$ chmod 600 authorized_keys2
music@Debian:~/.ssh$ cat id_dsa.pub >> authorized_keys2
music@Debian:~/.ssh$ ls
total 12K
-rw------- 1 music music 602 Feb 19 22:01 authorized_keys2
-rw------- 1 music music 736 Feb 19 21:49 id_dsa
-rw-r--r-- 1 music music 602 Feb 19 21:49 id_dsa.pub |
Ik haal nu met Winscp mijn id_dsa op zodat ik op mijn windows bak met putty kan connecten naar de ssh server. Vervolgens open ik puttygen, ik druk op conversions en import key (id_dsa). Nu druk ik op save private key
Putty opstarten, key selecteren en user music
code:
1
2
3
| Using username "music".
Server refused our key
Password: |
Hieronder mijn sshd_config
code:
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
| Debian:/etc/ssh# cat sshd_config
# Package generated configuration file
# See the sshd(8) manpage for defails
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
AllowGroups music
AllowUsers music
DenyGroups root
DenyUsers root
# ...but breaks Pam auth via kbdint, so we have to turn it off
# Use PAM authentication via keyboard-interactive so PAM modules can
# properly interface with the user (off due to PrivSep)
#PAMAuthenticationViaKbdInt no
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 60
PermitRootLogin no
StrictModes yes
DSAAuthentication yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
AuthorizedKeysFile /home/music/.ssh/authorized__keys2
# rhosts authentication should not be used
#RhostsAuthentication no
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Uncomment to disable s/key passwords
#ChallengeResponseAuthentication no
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
# To change Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#AFSTokenPassing no
#KerberosTicketCleanup no
# Kerberos TGT Passing does only work with the AFS kaserver
#KerberosTgtPassing yes
X11Forwarding no
X11DisplayOffset 10
PrintMotd no
#PrintLastLog no
KeepAlive no
#UseLogin no
MaxStartups 2:50:10
#Banner /etc/issue.net
#ReverseMappingCheck yes
Subsystem sftp /usr/lib/sftp-server
UsePAM yes |
En de directory rechten van de bestanden in /etc/ssh
code:
1
2
3
4
5
6
7
8
9
10
| Debian:/etc/ssh# ls -al
total 144
drwxr-xr-x 2 root root 4096 Feb 19 22:12 .
drwxr-x--x 78 root root 4096 Feb 19 13:11 ..
-rw-r--r-- 1 root root 111892 Nov 28 16:33 moduli
-rw-r--r-- 1 root root 1185 Nov 28 16:33 ssh_config
-rw------- 1 root root 668 Feb 2 16:02 ssh_host_dsa_key
-rw-r--r-- 1 root root 601 Feb 2 16:02 ssh_host_dsa_key.pub
-rw-r--r-- 1 root root 2205 Feb 19 22:08 sshd_config
-rw-r--r-- 1 root root 2045 Feb 2 16:02 sshd_config.dpkg-old |
Ik hoop dat iemand mij effe kan helpen, thankss