LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-06-2011, 07:58 PM   #16
djtoltz
Member
 
Registered: Nov 2003
Location: Eastern North Carolina, USA
Distribution: Mandrake
Posts: 51

Rep: Reputation: 20

If you issue the "cat key.pub >> ~/.ssh/authorized_keys", it will create the file and append the public key to it. You can have more than one public key in that file, so it is best to concatenate, rather than overwrite it.

I'm not going to be much help with Cygwin, but the man page for ssh should tell you where the authorized_keys2 file is to be stored. You'll just need to copy your public/private key pair (key and key.pub) from linux to Windows, put them in the right place, and you can just rename the key.pub file to authorized_keys2. It will have the same effect as appending it to an empty file.

I tell all of my friends to get rid of Windoze.
 
Old 01-07-2011, 02:02 AM   #17
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi guys,

I've noticed you're moving forward pretty good mansour. Some remarks however:

@djtoltz: where have you learned about the authorized_keys2 file or is that a typo? I've never encountered it nor used it, the one I know of is authorized_keys.

@mansour: If you're only wanting to copy files over from your Ubuntu maching to your Windoze XP, then I think using Cygwin and SSH is a bit overkill, I'd use Samba for that on the Ubuntu side and a shared folder on the Windows XP machine. It'll take up less of your time and doesn't need 'strange' software on the Windoze side.

Setting up the Ubuntu machine for SSH access isn't that hard and you've already have most of the configuration set up. If you want to access that machine from the outside you'll also need to configure your router.

Kind regards,

Eric
 
Old 01-07-2011, 08:17 AM   #18
djtoltz
Member
 
Registered: Nov 2003
Location: Eastern North Carolina, USA
Distribution: Mandrake
Posts: 51

Rep: Reputation: 20
@EricTRA No, "authorized_keys2" was not a typo. I guess it is now historic, and I don't look things up until something stops working. Back in the old days there was "authorized_keys", then when ssh v2 came along, there was "authorized_keys" for version 1 and "authorized_keys2" for version 2. Now, I guess, they went back to just "authorized_keys". Sorry for the misinformation. It works fine in my setup. I use ssh everywhere. Maybe, my software is configured to be backwards compatible.

Thanks for the heads up.
 
Old 01-07-2011, 08:24 AM   #19
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

@djtoltz: Thanks for the clarification. I looked it up also with Google. The change you're referring to dates back to 2001 when OpenSSH 3 was released.
Quote:
Important Changes:
==================

1) SSH protocol v2 is now the default protocol version

use the 'Protocol' option from ssh(1) and sshd(8) if
you need to change this.

2) The files
/etc/ssh_known_hosts2
~/.ssh/known_hosts2
~/.ssh/authorized_keys2
are now obsolete, you can use
/etc/ssh_known_hosts
~/.ssh/known_hosts
~/.ssh/authorized_keys
For backward compatibility ~/.ssh/authorized_keys2 will still used for
authentication and hostkeys are still read from the known_hosts2.
However, those deprecated files are considered 'readonly'. Future
releases are likely not to read these files.
Anyway, it's good to know things like this, thanks for sharing.

Kind regards,

Eric
 
Old 01-11-2011, 12:08 AM   #20
mansour
Member
 
Registered: Nov 2010
Location: Toronto, Canada
Distribution: Ubuntu 10.04 Lucid Lynx - Ubuntu 10.10 notebook - Debian 5.08 - Win XP
Posts: 172

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by djtoltz View Post
If you issue the "cat key.pub >> ~/.ssh/authorized_keys", it will create the file and append the public key to it. You can have more than one public key in that file, so it is best to concatenate, rather than overwrite it.

I'm not going to be much help with Cygwin, but the man page for ssh should tell you where the authorized_keys2 file is to be stored. You'll just need to copy your public/private key pair (key and key.pub) from linux to Windows, put them in the right place, and you can just rename the key.pub file to authorized_keys2. It will have the same effect as appending it to an empty file.

I tell all of my friends to get rid of Windoze.


Hello djtoltz:


My deepest apology to you and EricTRA, because for 3 or 4 days I kept checking my thread back and didn't notice that there was a second page added to my thread. I thought you guys both lost interest and left my thread for good.
Anyway I am here and back, thank you both so much, because I am learning so much from you two here.

OK, I just found my id_dsa and id_dsa.pub files yesterday.This is the path to them:
You know the online ubuntu server Guide is very confusing sometimes. The guide says it is ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub but this path gave me nothing.
The real path for the files is /root/.ssh/id_dsa and /root/.ssh/id_dsa.pub
so I used your command and made the authorized_keys file.
cat key.pub >> ~/.ssh/authorized_keys it worked beautifully.
So now I have the authorized_keys created on my SSH server.

But now I don't know how to copy to windows.

But thanks a lot you brought me this far. And sorry that lost the communication for 4 days.
I guess I am newbie after all.I am just learning to pay more attention to details of page.



mansour

Last edited by mansour; 01-11-2011 at 12:39 AM.
 
Old 01-11-2011, 12:32 AM   #21
mansour
Member
 
Registered: Nov 2010
Location: Toronto, Canada
Distribution: Ubuntu 10.04 Lucid Lynx - Ubuntu 10.10 notebook - Debian 5.08 - Win XP
Posts: 172

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by EricTRA View Post
Hi guys,

I've noticed you're moving forward pretty good mansour. Some remarks however:

@djtoltz: where have you learned about the authorized_keys2 file or is that a typo? I've never encountered it nor used it, the one I know of is authorized_keys.

@mansour: If you're only wanting to copy files over from your Ubuntu maching to your Windoze XP, then I think using Cygwin and SSH is a bit overkill, I'd use Samba for that on the Ubuntu side and a shared folder on the Windows XP machine. It'll take up less of your time and doesn't need 'strange' software on the Windoze side.

Setting up the Ubuntu machine for SSH access isn't that hard and you've already have most of the configuration set up. If you want to access that machine from the outside you'll also need to configure your router.

Kind regards,

Eric

Hello Eric:


My deepest apology to you as well, because for 3 or 4 days I kept checking my thread back and didn't notice that there was a second page added to my thread. I thought you guys both lost interest and left my thread for good.
Anyway I am here and back, thank you I am learning so much from you here.

You know interesting you are saying this, I actually started a samba thread in the server section of this Forum, but didn't get much far with it and then gave up, and then my server got really messed up due to some mistakes. So I re-installed manually instead of using tasksel tool and I am rebuilding everything from scratch.
I am seeing people are more helpful in this newbie section.

This is the old samba thread that doesn't exist anymore. But just so that you see.

http://www.linuxquestions.org/questi...=1#post4187219

So if you give me a day or two I reinstall my samba and then if I have any problem again, maybe you help me with it. First time I had a lot of hard time.

So I have been trying to transfer files using samba and now SSH, so far to no avails.
So far I have been successful with DHCP and DNS servers only.

Best regards,

mansour
 
Old 01-11-2011, 02:02 AM   #22
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

No need for apologies, things like that happen a lot Take your time to reinstall your server, there's no pressure. We'll be around when you get back.

Kind regards,

Eric
 
Old 01-11-2011, 02:32 AM   #23
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
One option for transferring files from Ubuntu to windows from the Ubuntu host is to install the sshd server in Cygwin.

Look at http://www.noah.org/ssh/cygwin-sshd.html for details on which Cygwin packages you need to install.
Another site is http://chinese-watercolor.com/LRP/pr...gwin-sshd.html
Yet another site: http://ist.uwaterloo.ca/~kscully/CygwinSSHD_W2K3.html
I found these links with the google search terms "cygwin ssh server". There are many others as well.

You will be able to use sftp then as well. You do need administrator access to install a service in windows.
 
Old 01-13-2011, 01:07 AM   #24
mansour
Member
 
Registered: Nov 2010
Location: Toronto, Canada
Distribution: Ubuntu 10.04 Lucid Lynx - Ubuntu 10.10 notebook - Debian 5.08 - Win XP
Posts: 172

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by jschiwal View Post
One option for transferring files from Ubuntu to windows from the Ubuntu host is to install the sshd server in Cygwin.

Look at http://www.noah.org/ssh/cygwin-sshd.html for details on which Cygwin packages you need to install.
Another site is http://chinese-watercolor.com/LRP/pr...gwin-sshd.html
Yet another site: http://ist.uwaterloo.ca/~kscully/CygwinSSHD_W2K3.html
I found these links with the google search terms "cygwin ssh server". There are many others as well.

You will be able to use sftp then as well. You do need administrator access to install a service in windows.



Hello jschiwal:



OK, so I followed your suggestion and went to this web site and downloaded cygwin again, even though I had it on my Win XP already. But this time, I actually installed all packages, and I think I did everything right, so what would I do from here?

What is that I should copy from my ssh server on ubuntu machine to the Win XP machine?
how would I copy it? what commands I mean?



Thank you for your help


mansour
 
Old 01-13-2011, 10:54 PM   #25
mansour
Member
 
Registered: Nov 2010
Location: Toronto, Canada
Distribution: Ubuntu 10.04 Lucid Lynx - Ubuntu 10.10 notebook - Debian 5.08 - Win XP
Posts: 172

Original Poster
Rep: Reputation: 2
Hello:


Today at work, I learned that if I setup a password is actually easier to setup ssh between ubuntu-server and Win XP. Because I already have Putty Program on Win XP.
I can log into Putty on XP and connect to my ubuntu-server. From ubuntu-server to Win XP
though, that's a tougher nut to crack.(I still don't how)
I learned that I can use rdesktop to connect from an ubuntu-desktop to win XP, but not from an ubuntu-server that has no GUI (X-window )and I am not installing a xwindow for my server. Once caused me a total re-install, I am not going down that path again.
But at least half of the connection gets resolved.

But now I log into Putty, give it my server ip address for hostname and port 22, and give it my server root username and its password. Everything goes well, except won't accept my root password.
I can't see what am I doing wrong here. Sometimes also I get: Network Error, Connection refused.
The password that Putty requires from me to connect from Win XP to ubuntu-server is the same as my ubuntu-server root password, am I right?

I am sooooooooooo lost.


mansour

Last edited by mansour; 01-13-2011 at 10:59 PM.
 
Old 01-14-2011, 04:21 AM   #26
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
First of all, you shouldn't allow root log ons for ssh on the Ubuntu server. It is better to log in as a regular user and use sudo. Ubuntu itself disables the root account for logons. You can't "su" to root using ubuntu, but you may be able to "sudo su".

The public key in Windows needs to be added to the ~/.ssh/authorized_keys file of the user you are logging in as.
If you load Putty's private key in Putty's KeyGen.exe program, you can display an openssh compatible public key. Use cut and paste to save a copy of this public key on the Ubuntu server and add it to the ~/.ssh/authorized_keys for the user you log in as.

Keep in mind that putty is a client and not a server. That is why I suggested those pages using Cygwin's ssh server. You do need to install it so that the root user in Cygwin has the proper Admin rights in Windows to allow starting the sshd service as a windows service. The links I gave should have instructions for this.

If you just have an ssh client on Windows, you can use sftp in cygwin or putty to pull files from the Ubuntu server, while on Windows. That is one thing I like about ssh. One could use a samba share for file sharing, but for one off copying, using ssh is much more convenient.
 
Old 01-15-2011, 12:01 PM   #27
mansour
Member
 
Registered: Nov 2010
Location: Toronto, Canada
Distribution: Ubuntu 10.04 Lucid Lynx - Ubuntu 10.10 notebook - Debian 5.08 - Win XP
Posts: 172

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by jschiwal View Post
First of all, you shouldn't allow root log ons for ssh on the Ubuntu server. It is better to log in as a regular user and use sudo. Ubuntu itself disables the root account for logons. You can't "su" to root using ubuntu, but you may be able to "sudo su".

The public key in Windows needs to be added to the ~/.ssh/authorized_keys file of the user you are logging in as.
If you load Putty's private key in Putty's KeyGen.exe program, you can display an openssh compatible public key. Use cut and paste to save a copy of this public key on the Ubuntu server and add it to the ~/.ssh/authorized_keys for the user you log in as.

Keep in mind that putty is a client and not a server. That is why I suggested those pages using Cygwin's ssh server. You do need to install it so that the root user in Cygwin has the proper Admin rights in Windows to allow starting the sshd service as a windows service. The links I gave should have instructions for this.

If you just have an ssh client on Windows, you can use sftp in cygwin or putty to pull files from the Ubuntu server, while on Windows. That is one thing I like about ssh. One could use a samba share for file sharing, but for one off copying, using ssh is much more convenient.


Hello jschiwal:


I don't know how to add the public key in Windows to the ~/.ssh/authorized_keys file, I don't know how to find any of these files in windows.

I actually did install the Cygwin (with all of its packages). Many mega bytes of data.
Actually I found that link not very helpful. I followed the instructions but it doesn't work for my machine. And what is the command for pulling a file ubuntu-server using sftp on windows machine.

The links and instructions in them sometimes work, sometimes don't, just like online Guide isn't working for my case.

I ran this command in Cygwin:

$ sftp mansour@ubuntu-server.mansour.net
ssh: connect to host ubuntu-server.mansour.net port 22: Connection refused Connection closed

$



Thank you

mansour

Last edited by mansour; 01-15-2011 at 12:15 PM.
 
Old 01-16-2011, 12:44 PM   #28
mansour
Member
 
Registered: Nov 2010
Location: Toronto, Canada
Distribution: Ubuntu 10.04 Lucid Lynx - Ubuntu 10.10 notebook - Debian 5.08 - Win XP
Posts: 172

Original Poster
Rep: Reputation: 2
Hello everyone:

I had kept a copy of /etc/ssh/sshd_config file as /etc/ssh/sshd_config.original.
I just removed the faulty copy and replaced with a fresh copy and then restarted the ssh.

Everything is OK now.
No configuration is needed if I use a password for it.
If I had known this, I wouldn't be so keen about not using password.
To use a username and password is the easiest configuration of all, no configuration at all.

I still didn't learn know how to setup private and public keys for no password scenario, but at least it works. The easiest way is working.



Mansour
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH host keys are not being read correctly from .ssh/known_hosts. bartonski Linux - Software 3 10-29-2009 05:40 PM
ssh to remote server using keys charan314 Linux - Enterprise 3 10-09-2009 02:44 AM
Logging in to SSH server with Keys SuperDude123 Linux - Server 6 05-05-2009 11:30 PM
ssh connection refused - trying to set up ssh server at home openSauce Linux - Server 10 10-18-2007 05:38 PM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 01:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration