Remove lfs-uefi.txt symlink
[linux_from_scratch_hints.git] / PREVIOUS_FORMAT / openssh_remote_floppy.txt
blob5c40cf6a018467ea7f86880231667816cd962fda
1 TITLE:          How to set up and use OpenSSH to connect from Windows machines
2 LFS VERSION:    All
3 AUTHOR:         Arturo Rangel <izaram@yahoo.com>
5 SYNOPSIS:
7         How to configure OpenSSH to be even more secure and how to make a
8 floppy disk that you can use on almost any Windows machine to access your
9 machine remotely.
10         
11 HINT:
12         09/03/2001 - First publication
13         09/04/2001 - Minor changes in formatting
14         10/11/2002 - Yay! Updated for SSH2, portable
15                      between different versions of Windos (tested in 98SE, ME
16                      and XP Professional)
17         
18 INTRODUCTION
20         Once I had my shiny LFS system I wanted to be with it all the time. I
21 wanted to work on it from work, from my girlfriend's house, from school,
22 everywhere. So I went out and read some documentation on how to set up OpenSSH
23 (including Daniel's hint on
24 http://hints.linuxfromscratch.org/hints/openssh.txt). Here's a summary of what
25 I came up with. I hope it helps you out and that you learn from it.
26         
28 DISCLAIMER
30         Just like the one the great Kevin Smith has at the beginning of Dogma
31 (go watch that movie if you have no idea what I'm talking about). Please make
32 sure you know what you are doing (or at least have an idea of what you are
33 doing) when you follow this hint. The author cannot be made responsible for any
34 missed configuration, run-over cats, hair loss or any other problem that arises
35 directly or indirectly from following the simple instructions stated here. Now
36 that we got that out of the way, let's move on.
37                 
38 SETTING UP THE SERVER   
40         First of all, in order to make your machine more secure you need to
41 disable the regular telnet daemon and make sure that OpenSSH gets started at
42 bootup (read Daniel's hint on how to do this). Once you have a running OpenSSH
43 fire up your favorite editor to change its configuration (the file in my system
44 is /etc/ssh/sshd_config).
45         
46         Make sure that the following options are set (1):
47         
48         IgnoreRhosts no
49         RhostsAuthentication no
50         RhostsRSAAuthentication yes
51         RSAAuthentication yes
52         PasswordAuthentication no
53         
54         Optionally, you can set this line:
55         
56         Protocol 2
57         
59         To make sure your server always uses the (more secure) version 2 protocol.
60         
61         What you are doing with these options is telling sshd to make sure that
62 all the people trying to log into your system have a valid encryption key and
63 not to allow login with a simple username/password combination. What this means
64 is that your users  will need to create a new key pair for themselves in your
65 system and they will need to have their file key handy (in a floppy or copied
66 into their laptop) whenever they want to log into the system. This might sound
67 a little cumbersome but the increased security is well worth it in my opinion.
68                 
69         Please make sure you read the Domain mini-HOWTO (1) if you want to
70 learn how to do do some other tricks (such as tunneling X over the connection)
72 CREATING YOUR PRIVATE/PUBLIC KEY COMBO
73         
74 This is the part of this hint where configuration varies slightly is you use
75 Protocol v1 or v2. To create an RSA key for v1, the user has to type this
76 command:
77         
78         ssh-keygen -b 1024 -f new_rsa_key
79         
80         This command will create two files in the curent directory: new_rsa_key
81 and new_rsa_key.pub. The first file is the private key and the second is the
82 public key (hence the .pub extension :). This key pair is v1 by default, read
83 on to create a v2 key.
84         
85         For a v2 key, the key has to be created using PuTTYgen, available from
86 the same place PuTTY is (2). Start up PuTTYgen and select SSH2 RSA as the type
87 of key you want to generate. Click on Generate and follow the instructions
88 while you wait for your key pair to be created. Once it's done, copy the text
89 that's supposed to go into your authorized_keys2 file, and save it into a file.
90 This is your public key. Click on Save private key and keep that file somewhere
91 handy. We'll come back to it. 
92         
93         Using either method, the user will be asked for a pass phrase.
94 Make_sure_this_is_not_blank. Doing that would mean that if someone found the
95 private key they would be able to use it to gain easy acces to your system.
96 Now have them copy the public key file into their $HOME/.ssh/authorized_keys
97 file for v1 or $HOME/.ssh/authorized_keys2 for v2. (You can simply type 'cat
98 new_rsa_key.pub >> $HOME/.ssh/authorized_keys (or) authorized_keys2' depending
99 on the protocol version you are using).
100         
101 CREATING YOUR PORTABLE CLIENT
103         Now the fun part. Copy the private key (new_rsa_key, or the one you
104 saved from PuTTYgen) file into a floppy and also put a copy of PuTTY (2), the
105 great ssh client for Windows, into the same floppy. Configure PuTTY with your
106 server parameters, etc. Make sure you select the appropiate protocol version
107 and that you point to the private key you saved before.
108         
109         PuTTY saves the fingerprint of every host it connects to in the Windows
110 registry to make sure that you are connecting to a host that has confirmed its
111 "identity" with you. The only downside to this is that you are not able to
112 carry this information with you, at least not easily.
113         
114         Here's what to do to save that information (as well as any changes you
115 make to the PuTTY configuration) and have it ready on the go. You can either
116 follow the instructions from the PuTTY authors and create a batch file with
117 some .reg files (3), or you can download a small VB program I wrote (4). The
118 difference between the two methods is that my program works between different
119 versions of Windows, since starting with Win2K, the files exported from the
120 registry are Unicode as opposed to regular ANSI files. This prevents older
121 versions of Windows from importing files that come from Win2K and WinXP
122 machines.
123         
124         Please be aware that using any of these two methods (a batch file or my
125 little program) might cause your current settings to be deleted from the
126 registry. (Well, ahem, at least *my* program warns you if that might happen :)
127         
128 CONCLUSION
130         Like I said at the beginning; I hope that you learned from this hint
131 and that it helps you have a far more secured server. Feel free to contact me
132 if you have any questions. I will try to answer the best I can.
133                         
134 NOTES
136         I have tested these instructions on Win 98SE/ME/XP machines. I have yet
137 to try on 95/NT/2K, but I see no reason for it not to work. I will update this
138 hint if I receive confirmations of it working on said machines.
139                 
140 FOOTNOTES
142 (1) The OpenSSH configuration was obtained from the Domain mini-HOWTO:
143     http://www.linuxdoc.org/HOWTO/mini/Domain.html
144 (2) PuTTYgen and PuTTY can be downloaded from:  
145     http://www.chiark.greenend.org.uk/~sgtatham/putty/
146 (3) Instruction on how to set up a DOS batch file for PuTTY are found here:
147     http://www.tartarus.org/~owen/putty-docs/Section3.13.html
148 (4) Or you can use the small program I wrote downloadable from:
149     http://izaram.net/pages/misc/PuTTYwrap.zip