LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-16-2008, 11:06 AM   #1
robward
LQ Newbie
 
Registered: Jan 2008
Posts: 2

Rep: Reputation: 0
Translating windows pscp command to linux scp command help


I have a batch job running on a windows 2000 server which uses pscp.exe to move files to another windows server.

The command is this...

pscp.exe -pw pass -batch -q file.txt user@server:./file.txt

and works fine.

This windows 2000 server is being decommissioned and a new server running red hat linux will now do this job.

Sadly this command on linux doesn't work

scp -pw pass -batch -q file.txt user@server:./file.txt

It looks as if I need to set up private / public keys as I can no longer specify the password in the command line.

Does anyone know how to configure the public private key on a windows 2000 box running WINSSHD, and what to do with it on the linux box?

Also, when I just use this command
scp -v file.txt user@server:./file.txt

I confirm the server is authentic, am prompted for a password, but then the system hangs.

On the linux server the debug stuff is

[linux_server]$ scp -v file.txt user@server:./file.txt
Executing: program /usr/bin/ssh host server, user user, command scp -v -t ./file.txt
OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: Connecting to server [server] port 22.
debug1: Connection established.
debug1: identity file /home/fambat/.ssh/identity type -1
debug1: identity file /home/fambat/.ssh/id_rsa type -1
debug1: identity file /home/fambat/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version 1.39 sshlib: WinSSHD 3.25
debug1: no match: 1.39 sshlib: WinSSHD 3.25
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.6.1p2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'server' is known and matches the DSA host key.
debug1: Found key in /home/fambat/.ssh/known_hosts:1
debug1: ssh_dss_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/fambat/.ssh/identity
debug1: Trying private key: /home/fambat/.ssh/id_rsa
debug1: Trying private key: /home/fambat/.ssh/id_dsa
debug1: Next authentication method: password
user@server's password:
debug1: Authentication succeeded (password).
debug1: fd 4 setting O_NONBLOCK
debug1: fd 5 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: scp -v -t ./file.txt
debug1: channel 0: request exec
debug1: channel 0: open confirm rwindow 16384 rmax 16384
debug1: channel_free: channel 0: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK

and then it hangs....

In the windows event log
[021] WinSSHD 3.25: Session thread 2982 handling connection from linux_server port 57381:
Connection from linux_server:57381 accepted.

[022] WinSSHD 3.25: Session thread 2982 handling connection from linux_server port 57381:
Client version string: SSH-2.0-OpenSSH_3.6.1p2

[040] WinSSHD 3.25: Session thread 2982 for user fame from linux_server port 57381:
Logon attempt 1 for user name fame succeeded. Logon attempt method: 'password'.

[049] WinSSHD 3.25: Session thread 2982 for user fame from linux_server port 57381:
Session server 89: Session server created.

[052] WinSSHD 3.25: Session thread 2982 for user fame from linux_server port 57381:
Session server 89: Exec request rejected: The user is not permitted to use exec requests.


The hanging problem on the linux server seems to be caused by the exec requests, but I don't understand why. Connecting to this same windows server using pscp.exe from my p.c. works fine.

So in summary (apologies if this post is too long) I have 2 problems.

1. How to get scp working from linux to a windows 200 server running WINSSHD?

2. How to set up scp as a batch job that requires no interaction or password prompting?

Any help on this would be much appreciated!

Rob.
 
Old 01-16-2008, 11:50 AM   #2
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
You need to run it as:

scp -i ~/.ssh/id_dsa file.txt user@server:file.txt

It will copy it to the home directory of server:/home/user.

You will need to run ssh-keygen and generate a key for user with a blank password, then you'll need to put the public key on the receiving server.

You need to do your homework on SSH and read on setting up encryption keys on Linux. It would take me a chapter to explain how to do it.
 
Old 01-17-2008, 06:02 AM   #3
robward
LQ Newbie
 
Registered: Jan 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Many thanks,
I've got it working now thanks to you.
I generaqted the key and installed it on the WINSSHD server and all works smoothly.
The other problem was resolved by changing the config of the WINSSHD to allow 'exec' calls.
It's odd that a linux scp call to WINSSHD needs exec rights, whilst a pscp call from windows to windows doesn't.

Anyway, thanks for your quick and precise help.
Rob.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scp command zchoyt Linux - General 10 04-02-2014 07:47 AM
SCP Command yusufs Linux - Newbie 3 11-07-2007 02:44 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
command of scp Paxmaster Linux - General 4 01-06-2005 12:59 PM
translating an iptables command back to ipchains reetep Linux - Networking 0 05-15-2004 06:17 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration