=== which123 is now known as myname === myname is now known as which === which is now known as which123 === asac_ is now known as asac === berlinerbaer1974 is now known as bb74 === berlinerbaer1974 is now known as bb74 === fdd-0 is now known as fdd === berlinerbaer1974 is now known as bb74 === thekorn_ is now known as thekorn [20:36] Hi [20:36] hey [20:36] So where to start? [20:36] What is it you're trying to do (simplified, first step)? [20:37] ok [20:37] sounds about right [20:38] seems what weve narrowed it down to anyways [20:38] Tell me. [20:39] Sorry i read that wrong [20:40] ok well im trying to enable ssh to connect from my personal computers to my lan's server via ssh but am trying to omit passwords [20:40] basically [20:41] Okay. How did you generate key pairs? [20:42] ill show you where i got started http://geekybits.blogspot.com/2007/11/passwordless-login-for-ssh.html [20:43] someone from here linked me to that earlier and i've been working through it for some time trying to customize it for my setup [20:43] How far did you get? [20:43] well i got pretty much through it and from what i can gather theres something wrong with my keypairs [20:45] because i scp'd the "id_rsa.pub" to the remote ~/.ssh/MY_Keys [20:45] than i cat'd the text from the remote MY_keys to authorized_keys [20:46] Sounds good. [20:46] some say that i should try having a file named authorized_keys in which i would assume would hold identical information [20:46] i also cat'd in the rsa pub key from my laptop and essentially this all should work [20:47] Did you cat the remote ~/.ssh/MY_Keys to the remote ~/.ssh/authorized_keys ? [20:47] chamunks: you may be interested in the "ssh-copy-id" command to transfer keys across [20:47] also, seahorse offers a graphical way to do it. [20:47] james_w: please don't confuse chamunks at this stage [20:48] i will keep this in mind for a later time [20:48] go on soundray_ [20:48] Did you cat the remote ~/.ssh/MY_Keys to the remote ~/.ssh/authorized_keys ? [20:48] yes i have [20:49] And now you're on the local (laptop I assume) and you ssh into the remote -- how? [20:49] Let me have the command line literally, pls [20:50] ssh grab@192.168.100.157 [20:50] grab would be the user on the server side [20:50] What exactly happens then? [20:50] it prompts me for a password [20:51] chamunks: for the passphrase or the remote user's password? [20:51] it says "grab@192.168.100.157's password: [20:51] i didnt generate my pairs with passphrases so there should be no prompt for them afaik [20:52] chamunks: double checking: the remote ~/.ssh is /home/grab/.ssh ? [20:52] yep [20:53] chamunks: and the permissions on all the files in there are 600? [20:53] I will confirm that now 1 min [20:55] im getting permission denied when i try to ls .ssh/ [20:55] chamunks: maybe the directory itself is 600 -- it should be 700. ls -ld /home/grab/.ssh [20:56] And owned by grab of course [20:57] Are you running back and forth to check this? [20:58] so contents should be 0600 and the directory should be 0700? [20:58] Yes [20:59] I'm expecting a phone call any minute, so if I drop out, that will be the reason [20:59] ok should i wait up? [20:59] if so how long? [21:00] Better not wait - could take long. [21:00] Anyway, what's the deal on the permissions? [21:00] ok i setup the contents to 0600 and the directory to 0700 and owner to grab [21:00] so thats all good [21:01] Was it like that? [21:01] Or did you have to change it? [21:01] i changed it [21:01] so ill try login again [21:01] If you changed something, retry ssh grab@192.168.100.157 [21:02] ok its still asking for a password. [21:02] Sorry, that's my 2c [21:03] allright ill c u later thanks for the help for now [21:03] Maybe ask the channel again -- I'll try and pop in later to see how you got on. [21:03] thanks i have to pop into work so i may / may not still be around [21:04] james_w, would you be able to help me? [21:04] chamunks, wait 5 [21:04] sure [21:06] chamunks, want some theory about what you are about to do or just dive in? [21:06] sure [21:07] ill go for some theory [21:07] but we could probably dive right in too [21:07] just a sec I'll be free in 60 second or so [21:07] k [21:09] chamunks, ok - the theory - consider a key and a lock [21:09] ok i think im good [21:09] you are putting a lock on the far machine with the ssh-key [21:09] the key on your local machine gets you there ;-) [21:10] ok so far? [21:10] yep yep [21:10] go on [21:10] so first can you log into the far end machine i.e. the server [21:10] cd .ssh [21:10] ^^ do that [21:10] omw [21:11] done [21:11] are you intending to log in from more than one machine to this box? [21:11] using the keyfiles yes [21:12] other users can use regular login credentials [21:12] ok [21:13] so in this directory we are going to be looking at two one main file [21:13] chamunks, this file is called authorized_keys [21:13] ok [21:14] sudo nano authorized_keys? [21:14] no [21:14] that would be crude ;-) [21:14] is there anything in there at this point - that is useful? [21:14] i.e. functioning? [21:15] i have the two public keys from the two computers i would like to enable passwordless access to [21:15] and the authorized_keys file [21:15] no it would be from in here [21:15] ok lets step back a moment [21:16] the way I start off with no access to a box is this on my client side i.e. the box that wants to log into the other box I do this [21:16] where to? [21:16] so on the client I do this [21:16] ssh-keygen -t rsa [21:17] this generates two files on the client machine [21:17] id_rsa and id_rsa.pub [21:17] the with that is not called .pub is your secret key [21:17] rsa seems to be what most use now [21:17] id_rsa <<<< this one [21:17] so ill stick with rsa and regenerate a new key pair [21:17] the other one you can stick on a web server or anywhere [21:18] and follow along here [21:18] ok then on the server lets get a few things straight [21:18] are you currently logging into anywhere automatically to the server up to this moment? [21:19] I will want you to clean out rubbish which is why I am trying to get you to tell me what you have in there [21:19] ok well ill clear out all my .ssh folders if you like so we can start a new [21:20] that would be very good of you cos it means we will have you working in 5 mins [21:20] if you can type as fast as me ;-) [21:20] on the client open a terminal [21:20] dont know my wpm but ill do what i can ;) [21:20] in the terminal type the following [21:20] ssh-keygen -t rsa [21:20] tell me when it is done [21:21] (Assuming you have both directories on both machines empty at this time) [21:21] ok done [21:21] is my assumption safe? [21:21] ill just do this once on my desktop here and recreate it all later on my laptop [21:21] yeop [21:21] yep [21:21] ko [21:21] then type this: [21:22] On the CLIENT machine: scp id_rsa.pub username@SERVER:/home/user/.ssh/source-box-name.pub [21:23] it will ask you for your password to the far end machine [21:23] you do that in the .ssh directory (but I guess you know that) [21:23] are you done? [21:23] yep [21:23] in the terminal open on the server [21:23] type this [21:24] is it ok that im only ssh'd into the terminal and have no direct access? [21:24] cat source-box-name.pub > authorized_keys [21:24] it is ok [21:24] now close your session from the desktop to the server [21:25] type [21:25] ssh -C username@SERVER [21:25] ok both authorized_keys and sbn.pub are in that folder [21:25] fine [21:25] so now have you typed this: ompaul> ssh -C username@SERVER [21:25] well thank you ompaul [21:26] that worked rather well [21:26] not finished yet [21:26] it says im logged in, go on [21:26] close that [21:26] go to the laptop [21:27] ok on the laptop (i dont have an irc client on there but its here) [21:27] there is one gotcha it has to do with shell redirection do you know what I am talking about#? [21:27] clean out the .ssh folder before we start up here [21:27] .ssh clean [21:27] ok [21:28] whats this gotcha [21:28] I'll name it before I type it [21:28] first [21:28] ssh-keygen -t rsa [21:28] done [21:28] scp id_rsa.pub username@SERVER:/home/user/.ssh/second-source-box-name.pub [21:29] gotcha is on the next line it is the >> to append not overwrite the authorized_keys file [21:29] cat source-box-name.pub >> authorized_keys [21:30] cos if you did > there you would overwrite the first key you had in there ;-) [21:30] ahh that is something i did not know about cat [21:30] it is about shell redirection [21:30] if I want to take the output of ls -al > file [21:30] if I do the same tomorrow it overwrites file [21:31] if however I do ls -al >> file [21:31] then I get two days worth (if there was ever any value in ls -al in the first place ;-) [21:31] ) [21:32] if the server ip changes you have problems with the hosts file it warns you about all sorts of evils like the man in the middle attack etc [21:32] so then you can remove the line if you are happy with the network [21:33] hmm [21:33] thats verry handy [21:33] so you dont allways have to write cat unless you need to append contents of one file to another [21:34] well you can take the output of a command with | and pass it to the next one [21:34] in cases where your saving output (loging mayhaps) you just write >(replace) or >> (to append) [21:34] logging is a special use case and appending is normal but there are times when fresh logs are better [21:34] if you have a compile time error ;-) [21:35] you change the source the old version is no use if you keep removing the last bug [21:35] so there ya go [21:35] ompaul, this is kindof above what i've learned so far but its good to have been taught this [21:35] you could have added a password to the ssh-keygen -t rsa point if you wanted a password on the key [21:36] in case you might be afk and would be afraid that someone could take your seat and do stuff [21:36] if you had auto logins not logged in ;-) [21:36] however it is a great reason to have a screen saver or logout policy [21:37] yeah no kidding. [21:37] you don't want to be offering your access to the next person [21:37] may i ask why the -C in the ssh command? [21:37] compress [21:37] it helps even on a home lan with only two machines [21:37] ok so a good one to just append [21:37] so if you have X running on both boxes you could do this kind of thing [21:38] ssh -X user@other-box xterm [21:38] and run on your local box an xterm from the other machine [21:38] (how I play music is ogg123) but not on this box [21:39] I just control it from here [21:39] but then I am sad ;-) [21:40] heh [21:40] someone just told me in a pm - not sad, just creatively mad [21:40] * ompaul is chuckling [21:40] im going to use that one [21:41] anyone got any other funky stuff they want to do with ssh or would like to "show and tel" [21:41] tell that is [21:42] suppose you wanted to lock the file from a domain or machine in a domain [21:42] but not elsewhere [21:42] you could do this: [21:42] have a file called "authorization" in the .ssh directory [21:42] well one of the reasons why i wanted this was so that i could automount a remote directory via ssh containing my music for amarok so i could use amarok to sort my library as it grows [21:43] in it have the the following lines [21:43] Key box-key.pub [21:43] Options allow-from="friendly.domain" [21:44] or -- (this line not in file) [21:44] Options deny-from="very.evil.domain" [21:45] ssh is so vast that one could write a book about it, fortunately some people have [21:45] at this point why would anyone use anything else lol [21:45] unless they dont care about other viewers that is [21:46] because vnc and krdc work well together in "OpenVPN" [21:47] chamunks, is intreigued [21:47] be aware that you can then disable passwords for logging on [21:47] with openssh so that unless you are at the machine the only way in is ssh [21:48] this means we trust the ssh server code [21:48] and given where it comes from it is reasonable to assume that it is ok - but it still needs testing [21:48] good ole openbsd team [21:50] if you wanted to wander around a file system top copy something you could use the somewhat deprecated sftp [21:51] top copy? [21:51] it behaves a little like ftp but is not half as cute as scp :) [21:51] secure F T P [21:51] to copy [21:52] ahh [21:52] now youve touched on openvpn mind giving me a debrief on vpns? [21:53] can I do that justice ;-) [21:53] I suppose so [21:53] i shouldnt ask you to after all the help you already gave me and my friends getting rather upset that im not there to enjoy apple pie yet (oops) [21:53] go grab the pie [21:54] I have to do a config of openvpn at some stage tonight but it is highly customised [21:54] oh i have to bicycle a half hour to get that this delicious debrief is right here [21:54] what I will do with you [21:54] about openvpn is give you a url read this page [21:54] ok that sounds good [21:54] good ole lit for later enjoyment [21:55] http://www.openvpn.net/index.php/documentation/howto.html [21:55] for anyone who has not been on the OpenVPN site in a while it has been totally changed but all the good data is still there [21:56] obviously the install method for Ubuntu / Debian or others in the same family are difference but the configs are the same [21:59] ompaul, well many thanks for your time. You have been immensely helpful. [23:54] #ubutu-canada