LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-13-2010, 07:00 AM   #1
ajpnaveen
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
SCP "Username and Password in single statement"


To
Dear People

I am trying to create a "GUI File Transfer " Application , for transferring the files within the network. For That I will obtain User name, Password through the GUI, I will have to append username and password in a single line and run it .
I am facing difficulties in exploring the "command", I will thankful, If if any helps me out

Regards
Naveen
 
Old 09-13-2010, 07:12 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Scp (ssh) does not allow for, or have an option to give the password.

You might want to have a look at password-less scp/ssh: Shortest passwordless ssh tutorial, ever or feed your search-engine with ssh password less for other tutorials.

Hope this helps.
 
Old 09-13-2010, 07:33 AM   #3
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
There are two other options you can also look at. First one is doing a pty/fork/exec of the scp command, this allows you to capture it's output and send it the password when it asks for it. Second would be to link against the libssh2 library and use it's functions to do the authentication and scp transfer.

In C for the first option you'd want to look at forkpty function.
 
Old 09-13-2010, 08:01 AM   #4
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Quote:
Originally Posted by estabroo View Post
There are two other options you can also look at. First one is doing a pty/fork/exec of the scp command, this allows you to capture it's output and send it the password when it asks for it. Second would be to link against the libssh2 library and use it's functions to do the authentication and scp transfer.

In C for the first option you'd want to look at forkpty function.
I was reading about somethying called "expect" this morning which also works for this function? Not sure if it still is used/secure (well obviously its not secure, as its storing your password in a unencrypted form).
 
Old 09-13-2010, 07:24 PM   #5
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
yep expect would work fine and I think quite a few of the scripting languages have an expect module
 
  


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
[SOLVED] "C preprocessor "/lib/cpp" fails sanity check" every single time. masmddr Linux - Software 3 08-03-2010 10:37 AM
Why "bash-2.05b$" in Terminal instead of "username@localhost username" jayelitumbiolo Linux - General 9 10-04-2009 03:16 AM
How Can I Use An "if" statement on a Single Command Line? jagooch Linux - General 4 02-10-2009 11:32 PM
Can you specify a password without being prompted using "scp"? hashbangbinbash Linux - Newbie 8 04-11-2008 05:45 AM
fdisk reports odd "Start "and "End" sectors on single partition eponymous Linux - Software 3 10-01-2007 03:41 PM

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

All times are GMT -5. The time now is 03:53 AM.

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