LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-10-2008, 10:10 PM   #1
thefountainhead100
LQ Newbie
 
Registered: Mar 2008
Posts: 27

Rep: Reputation: 15
Unhappy SSH without password ?


hi

I want to write a script that would transfer files from my laptop to a intel/crossbow stargate board that has its own debian based linux kernel.
Since the script transfers of a series of files named in numerical order, I am trying to scp the files using a for loop.

Now it asks for a password everytime. I tried using the RSA keygen as explained in the tutorial here http:////linuxproblem.org/art_9.html, but the keygen command in the board doesnt have a -t rsa option. It says unknown option or too many commands.

How can I transfer a set of files one by one from the board to my computer without having to type in the password everytime ?

Thnx
ash

I
 
Old 03-10-2008, 10:18 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Does it support dsa keys? Maybe it's version was built without rsa support.

Last edited by jschiwal; 03-10-2008 at 10:23 PM.
 
Old 03-11-2008, 12:44 AM   #3
thefountainhead100
LQ Newbie
 
Registered: Mar 2008
Posts: 27

Original Poster
Rep: Reputation: 15
I donot know. I would check tomorrow and post again. But if it does support DSA keys then how would I be able to do it ? Could you give instructions please ?

Thanks.
 
Old 03-11-2008, 01:26 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Run ssh-keygen on your local machine with the -t dsa option. This will produce a ~/.ssh/id_dsa.pub file. Then scp this file to the remote machine (using a target name of id_dsa.pub.<hostname> to indicate from which host this is would be a good idea to keep things straight. example: "scp user@host .ssh/id_dsa.pub id_dsa.pub.spring"
Then ssh into the remote machine. Now you need to add the public key to your .ssh/authorized_keys file on the remote machine:
example: cat id_dsa.pub.spring >>.ssh/authorized_keys

You also need to check the /etc/ssh/sshd_config of the target machine.
Here are the uncommented entries of mine:
Code:
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
The sshd_config file should be well commented. The above comment tells you how to use PAM for account and session checks but not for authentication.
Also make sure to disable root logins, only allow protocol 2, and if only a few users can ssh in, use the "AllowUsers <username1> <username2>" line to disallow all other connection attempts. Many people also change the port used. Doing so will reduce the number of script kiddie attacks dramatically.
Code:
Protocol 2
PermitRootLogin no
PasswordAuthentication no
UsePAM yes

AllowUsers jschiwal
You could avoid repeated scp commands by using sftp instead and running an ftp batch file, which you could construct on the fly as well.

example:
Code:
find ~/Documents/pics/ -type f -name "*.jpg" -mtime 1 >ftpbatch
sed -i 's/^/put /' ftpbatch
sftp -b ftpbatch fountainhead@crossbow:Documents/

Last edited by jschiwal; 03-11-2008 at 02:00 AM.
 
  


Reply



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 without password hk_linux Linux - General 13 11-11-2010 04:20 PM
need help with no password ssh and ssh-agent hedpe Linux - Networking 3 02-08-2007 08:49 PM
SSH without password Ephracis Linux - Security 4 02-25-2005 02:30 PM
can't do password less ssh nedian123 Linux - Networking 2 06-26-2004 03:33 PM
password less SSH maaand Linux - Networking 0 04-23-2002 08:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:11 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
Open Source Consulting | Domain Registration