/srv/irclogs.ubuntu.com/2008/05/08/#ubuntu-classroom.txt

=== 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
soundray_Hi20:36
chamunkshey20:36
chamunksSo where to start?20:36
soundray_What is it you're trying to do (simplified, first step)?20:36
chamunksok20:37
chamunkssounds about right20:37
chamunksseems what weve narrowed it down to anyways20:38
soundray_Tell me.20:38
chamunksSorry i read that wrong20:39
chamunksok well im trying to enable ssh to connect from my personal computers to my lan's server via ssh but am trying to omit passwords20:40
chamunksbasically20:40
soundray_Okay. How did you generate key pairs?20:41
chamunksill show you where i got started http://geekybits.blogspot.com/2007/11/passwordless-login-for-ssh.html20:42
chamunkssomeone from here linked me to that earlier and i've been working through it for some time trying to customize it for my setup20:43
soundray_How far did you get?20:43
chamunkswell i got pretty much through it and from what i can gather theres something wrong with my keypairs20:43
chamunksbecause i scp'd the "id_rsa.pub" to the remote ~/.ssh/MY_Keys20:45
chamunksthan i cat'd the text from the remote MY_keys to authorized_keys20:45
soundray_Sounds good.20:46
chamunkssome say that i should try having a file named authorized_keys in which i would assume would hold identical information20:46
chamunksi also cat'd in the rsa pub key from my laptop and essentially this all should work20:46
soundray_Did you cat the remote ~/.ssh/MY_Keys to the remote ~/.ssh/authorized_keys ?20:47
james_wchamunks: you may be interested in the "ssh-copy-id" command to transfer keys across20:47
james_walso, seahorse offers a graphical way to do it.20:47
soundray_james_w: please don't confuse chamunks at this stage20:47
chamunksi will keep this in mind for a later time20:48
chamunksgo on soundray_20:48
soundray_Did you cat the remote ~/.ssh/MY_Keys to the remote ~/.ssh/authorized_keys ?20:48
chamunksyes i have20:48
soundray_And now you're on the local (laptop I assume) and you ssh into the remote -- how?20:49
soundray_Let me have the command line literally, pls20:49
chamunksssh grab@192.168.100.15720:50
chamunksgrab would be the user on the server side20:50
soundray_What exactly happens then?20:50
chamunksit prompts me for a password20:50
soundray_chamunks: for the passphrase or the remote user's password?20:51
chamunksit says "grab@192.168.100.157's password:20:51
chamunksi didnt generate my pairs with passphrases so there should be no prompt for them afaik20:51
soundray_chamunks: double checking: the remote ~/.ssh is /home/grab/.ssh ?20:52
chamunksyep20:52
soundray_chamunks: and the permissions on all the files in there are 600?20:53
chamunksI will confirm that now 1 min20:53
chamunksim getting permission denied when i try to ls .ssh/20:55
soundray_chamunks: maybe the directory itself is 600 -- it should be 700. ls -ld /home/grab/.ssh20:55
soundray_And owned by grab of course20:56
soundray_Are you running back and forth to check this?20:57
chamunksso contents should be 0600 and the directory should be 0700?20:58
soundray_Yes20:58
soundray_I'm expecting a phone call any minute, so if I drop out, that will be the reason20:59
chamunksok should i wait up?20:59
chamunksif so how long?20:59
soundray_Better not wait - could take long.21:00
soundray_Anyway, what's the deal on the permissions?21:00
chamunksok i setup the contents to 0600 and the directory to 0700 and owner to grab21:00
chamunksso thats all good21:00
soundray_Was it like that?21:01
soundray_Or did you have to change it?21:01
chamunksi changed it21:01
chamunksso ill try login again21:01
soundray_If you changed something, retry ssh grab@192.168.100.15721:01
chamunksok its still asking for a password.21:02
soundray_Sorry, that's my 2c21:02
chamunksallright ill c u later thanks for the help for now21:03
soundray_Maybe ask the channel again -- I'll try and pop in later to see how you got on.21:03
chamunksthanks i have to pop into work so i may / may not still be around21:03
chamunksjames_w, would you be able to help me?21:04
ompaulchamunks, wait 521:04
chamunkssure21:04
ompaulchamunks, want some theory about what you are about to do or just dive in?21:06
chamunkssure21:06
chamunksill go for some theory21:07
chamunksbut we could probably dive right in too21:07
ompauljust a sec I'll be free in 60 second or so21:07
chamunksk21:07
ompaulchamunks, ok - the theory - consider a key and a lock21:09
chamunksok i think im good21:09
ompaulyou are putting a lock on the far machine with the ssh-key21:09
ompaulthe key on your local machine gets you there ;-)21:09
ompaulok so far?21:10
chamunksyep yep21:10
chamunksgo on21:10
ompaulso first can you log into the far end machine i.e. the server21:10
ompaulcd .ssh21:10
ompaul^^ do that21:10
chamunksomw21:10
chamunksdone21:11
ompaulare you intending to log in from more than one machine to this box?21:11
chamunksusing the keyfiles yes21:11
chamunksother users can use regular login credentials21:12
ompaulok21:12
ompaulso in this directory we are going to be looking at two one main file21:13
ompaulchamunks, this file is called authorized_keys21:13
chamunksok21:13
chamunkssudo nano authorized_keys?21:14
ompaulno21:14
ompaulthat would be crude ;-)21:14
ompaulis there anything in there at this point - that is useful?21:14
ompauli.e. functioning?21:14
chamunksi have the two public keys from the two computers i would like to enable passwordless access to21:15
chamunksand the authorized_keys file21:15
ompaulno it would be from in here21:15
ompaulok lets step back a moment21:15
ompaulthe 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 this21:16
chamunkswhere to?21:16
ompaulso on the client I do this21:16
ompaulssh-keygen -t rsa21:16
ompaulthis generates two files on the client machine21:17
ompaulid_rsa and id_rsa.pub21:17
ompaulthe with that is not called .pub is your secret key21:17
chamunksrsa seems to be what most use now21:17
ompaulid_rsa <<<< this one21:17
chamunksso ill stick with rsa and regenerate a new key pair21:17
ompaulthe other one you can stick on a web server or anywhere21:17
chamunksand follow along here21:18
ompaulok then on the server lets get a few things straight21:18
ompaulare you currently logging into anywhere automatically to the server up to this moment?21:18
ompaulI will want you to clean out rubbish which is why I am trying to get you to tell me what you have in there21:19
chamunksok well ill clear out all my .ssh folders if you like so we can start a new21:19
ompaulthat would be very good of you cos it means we will have you working in 5 mins21:20
ompaulif you can type as fast as me ;-)21:20
ompaulon the client open a terminal21:20
chamunksdont know my wpm but ill do what i can ;)21:20
ompaulin the terminal type the following21:20
ompaulssh-keygen -t rsa21:20
ompaultell me when it is done21:20
ompaul(Assuming you have both directories on both machines empty at this time)21:21
chamunksok done21:21
ompaulis my assumption safe?21:21
chamunksill just do this once on my desktop here and recreate it all later on my laptop21:21
chamunksyeop21:21
chamunksyep21:21
ompaulko21:21
ompaulthen type this:21:21
ompaulOn the CLIENT machine:       scp id_rsa.pub username@SERVER:/home/user/.ssh/source-box-name.pub21:22
ompaulit will ask you for your password to the far end machine21:23
ompaulyou do that in the .ssh directory (but I guess you know that)21:23
ompaulare you done?21:23
chamunksyep21:23
ompaulin the terminal open on the server21:23
ompaultype this21:23
chamunksis it ok that im only ssh'd into the terminal and have no direct access?21:24
ompaulcat source-box-name.pub > authorized_keys21:24
ompaulit is ok21:24
ompaulnow close your session from the desktop to the server21:24
ompaultype21:25
ompaulssh -C username@SERVER21:25
chamunksok both authorized_keys and sbn.pub are in that folder21:25
ompaulfine21:25
ompaulso now have you typed this:   ompaul> ssh -C username@SERVER21:25
chamunkswell thank you ompaul21:25
chamunksthat worked rather well21:26
ompaulnot finished yet21:26
chamunksit says im logged in, go on21:26
ompaulclose that21:26
ompaulgo to the laptop21:26
chamunksok on the laptop (i dont have an irc client on there but its here)21:27
ompaulthere is one gotcha it has to do with shell redirection do you know what I am talking about#?21:27
ompaulclean out the .ssh folder before we start up here21:27
chamunks.ssh clean21:27
ompaulok21:27
chamunkswhats this gotcha21:28
ompaulI'll name it before I type it21:28
ompaulfirst21:28
ompaulssh-keygen -t rsa21:28
chamunksdone21:28
ompaulscp id_rsa.pub username@SERVER:/home/user/.ssh/second-source-box-name.pub21:28
ompaulgotcha is on the next line it is the >> to append not overwrite the authorized_keys file21:29
ompaulcat source-box-name.pub >> authorized_keys21:29
ompaulcos if you did > there you would overwrite the first key you had in there ;-)21:30
chamunksahh that is something i did not know about cat21:30
ompaulit is about shell redirection21:30
ompaulif I want to take the output of ls -al >  file21:30
ompaulif I do the same tomorrow it overwrites file21:30
ompaulif however I do ls -al >> file21:31
ompaulthen I get two days worth (if there was ever any value in ls -al in the first place ;-)21:31
ompaul)21:31
ompaulif 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 etc21:32
ompaulso then you can remove the line if you are happy with the network21:32
chamunkshmm21:33
chamunksthats verry handy21:33
chamunksso you dont allways have to write cat unless you need to append contents of one file to another21:33
ompaulwell you can take the output of a command with | and pass it to the next one21:34
chamunksin cases where your saving output (loging mayhaps) you just write >(replace) or >> (to append)21:34
ompaullogging is a special use case and appending is normal but there are times when fresh logs are better21:34
ompaulif you have a compile time error ;-)21:34
ompaulyou change the source the old version is no use if you keep removing the last bug21:35
ompaulso there ya go21:35
chamunksompaul, this is kindof above what i've learned so far but its good to have been taught this21:35
ompaulyou could have added a password to the ssh-keygen -t rsa point if you wanted a password on the key21:35
ompaulin case you might be afk and would be afraid that someone could take your seat and do stuff21:36
ompaulif you had auto logins not logged in ;-)21:36
ompaulhowever it is a great reason to have a screen saver or logout policy21:36
chamunksyeah no kidding.21:37
ompaulyou don't want to be offering your access to the next person21:37
chamunksmay i ask why the -C in the ssh command?21:37
ompaulcompress21:37
ompaulit helps even on a home lan with only two machines21:37
chamunksok so a good one to just append21:37
ompaulso if you have X running on both boxes you could do this kind of thing21:37
ompaulssh -X user@other-box xterm21:38
ompauland run on your local box an xterm from the other machine21:38
ompaul(how I play music is ogg123) but not on this box21:38
ompaulI just control it from here21:39
ompaulbut then I am sad ;-)21:39
chamunksheh21:40
ompaulsomeone just told me in a pm - not sad, just creatively mad21:40
* ompaul is chuckling21:40
chamunksim going to use that one21:40
ompaulanyone got any other funky stuff they want to do with ssh or would like to "show and tel"21:41
ompaultell that is21:41
ompaulsuppose you wanted to lock the file from a domain or machine in a domain21:42
ompaulbut not elsewhere21:42
ompaulyou could do this:21:42
ompaulhave a file called "authorization" in the .ssh directory21:42
chamunkswell 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 grows21:42
ompaulin it have the the following lines21:43
ompaulKey box-key.pub21:43
ompaulOptions allow-from="friendly.domain"21:43
ompaulor -- (this line not in file)21:44
ompaulOptions deny-from="very.evil.domain"21:44
ompaulssh is so vast that one could write a book about it, fortunately some people have21:45
chamunksat this point why would anyone use anything else lol21:45
chamunksunless they dont care about other viewers that is21:45
ompaulbecause vnc and krdc work well together in "OpenVPN"21:46
chamunkschamunks, is intreigued21:47
ompaulbe aware that you can then disable passwords for logging on21:47
ompaulwith openssh so that unless you are at the machine the only way in is ssh21:47
ompaulthis means we trust the ssh server code21:48
ompauland given where it comes from it is reasonable to assume that it is ok - but it still needs testing21:48
chamunksgood ole openbsd team21:48
ompaulif you wanted to wander around a file system top copy something you could use the somewhat deprecated sftp21:50
chamunkstop copy?21:51
ompaulit behaves a little like ftp but is not half as cute as scp :)21:51
ompaulsecure F T P21:51
ompaulto copy21:51
chamunksahh21:52
chamunksnow youve touched on openvpn mind giving me a debrief on vpns?21:52
ompaulcan I do that justice ;-)21:53
ompaulI suppose so21:53
chamunksi 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
ompaulgo grab the pie21:53
ompaulI have to do a config of openvpn at some stage tonight but it is highly customised21:54
chamunksoh i have to bicycle a half hour to get that this delicious debrief is right here21:54
ompaulwhat I will do with you21:54
ompaulabout openvpn is give you a url read this page21:54
chamunksok that sounds good21:54
chamunksgood ole lit for later enjoyment21:54
ompaulhttp://www.openvpn.net/index.php/documentation/howto.html21:55
ompaulfor anyone who has not been on the OpenVPN site in a while it has been totally changed but all the good data is still there21:55
ompaulobviously the install method for Ubuntu / Debian or others in the same family are difference but the configs are the same21:56
chamunksompaul, well many thanks for your time.  You have been immensely helpful.21:59
emmet_#ubutu-canada23:54

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!