SFTP using user id and password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP using user id and password
# 1  
Old 04-28-2010
SFTP using user id and password

Hi,

I am using below syntax -

sftp -b passwordfile userid@ipaddress

passwordfile is a file, in which I have just kept a password of userid.

But by this, an error is coming like -
Permission denied (publickey,password,keyboard-interactive).

Please suggest me on this..as I dont want this in interactive mode, i want to pass password in sftp syntax only..
# 2  
Old 04-28-2010
This is asked quite often in the forum - sftp is used either with entering password etc. manually or passwordless via key exchange.
The -b is to specify a batchfile that contains commands, not passwords.

Set up public keys which have been generated without entering a passphrase using ssh-keygen and try again.

Also scp might be more comfortable than sftp, if you have a choice.
# 3  
Old 04-28-2010
I dont want to use keys..
Could you please help me If I can use password with the command itself..
Because I dont want interactive mode for connecting to other server.
# 4  
Old 04-28-2010
Keys are much more secure than clear passwords stored in some file. It supports, as said already, usage of keys or interactive passwords. It does not support password supply from files!

Keys are easy, keys are secure, so why don't use keys...

If you still don't want to use keys, I can't help you Smilie

Last edited by zaxxon; 04-29-2010 at 03:17 AM.. Reason: tried to write english :D
# 5  
Old 04-28-2010
You can try
Code:
user=monalisha
passwd=xxxxxx
ip=1.2.3.4
lftp -u ${user},${passwd} sftp://${ip}<<EOF 
ls
bye
EOF

# 6  
Old 04-28-2010
To fool a program into thinking that it's running in interactive mode, use expect. Or use a pty wrapper like a perl module or write a C program.
# 7  
Old 04-28-2010
Quote:
Originally Posted by Monalisa
I dont want to use keys..
Could you please help me If I can use password with the command itself..
Because I dont want interactive mode for connecting to other server.
If you don't want an interactive login, why are you trying to use interactive password authentication? Use pre-shared keys. That's what they're there for.

ssh is designed to stop you from shoehorning in stored plaintext passwords; you really have to go out of your way to fake it well enough to fool it. This is a subtle hint written in mile-high flashing neon letters. You're not supposed to do this. Stored passwords are obsolete. There's better ways to do what you want, ways that do exactly what you want without the fundamental security flaws of storing passwords.

Last edited by Corona688; 04-28-2010 at 07:37 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passwordless sftp using a different user than the runtime user

I am running a shell script as user A. In that script I need to execute a sftp that would transfer the file using another user B. I am using the below command: sftp -oPort22 B@remote server However, I am getting password prompts each time. I have done the following: Added the public... (4 Replies)
Discussion started by: mady135
4 Replies

2. Shell Programming and Scripting

Sftp with password

I have been tasked with scripting a sftp transfer from my clients sftp server to a vendor. I have been given a user name and password. This is an older OEL server, 5.2. I am not able to install any packages on this system. It does not have expect, ssh-pass, or any other ssh password helper... (6 Replies)
Discussion started by: mtrgoose
6 Replies

3. Shell Programming and Scripting

SFTP prompting for password even though password is in script

Hi All, I am trying to transfer a file from one server to a remote server using SFTP. Client is not ready for key setup. I am working on Solaris 10. Here is the code. #!/bin/ksh # sample automatic Sftp script to dump a file USER="user1" PASSWORD="pass1" HOST="host1" sftp $USER@$HOST... (6 Replies)
Discussion started by: megha2525
6 Replies

4. Shell Programming and Scripting

SFTP with Password

Hi Guys, I need to know how can i achieve SFTP "with" password in a shell script. I have already done passwordless key generation thing and it is working but at the moment i am interested in passing a password. And another question I have is say i have a.ksh and b.sh scripts...Can i invoke... (6 Replies)
Discussion started by: Arpit Narula
6 Replies

5. Shell Programming and Scripting

sftp is asking password

Hi i have generate public private key pair using command ssh-keygen -t rsa -b 2048 and then it made the two keys under the directory ~/.ssh ( in server 1) one is public key and another one is private .. i copied public one key onto my second server under the directory ... (22 Replies)
Discussion started by: aishsimplesweet
22 Replies

6. Shell Programming and Scripting

password - SFTP

Hi team, I know if we need to transfer the files between between 2 servser, we use SFTP through key setup between 2 server. currently There are some problems and we are not able to setup keys between servers. How can i use password with SFTP for temporary solutions, so that the file... (6 Replies)
Discussion started by: Amit.Sagpariya
6 Replies

7. UNIX for Advanced & Expert Users

How to use SFTP from command line without entering user and password

I would like to use SFTP from command line without entering userid and password. Here is what I have gathered and did. 1) Create a public and private key pair for the protocol you want to use. To create a key pair for use by SSH2, enter: ssh-keygen -t dsa I did that and got... (7 Replies)
Discussion started by: Hangman2
7 Replies

8. UNIX for Advanced & Expert Users

password verification verify password of a user for only first 8 characters

Helo , I m using linux pam library for user and its password authentication. I m creating new user and giving its password.I m giving password of 10 characters.now when I login in as that newly created user its ask me $ su - ram Password: You are required to change your password immediately... (12 Replies)
Discussion started by: amitpansuria
12 Replies

9. UNIX for Dummies Questions & Answers

sftp prompting for password

I have the problem with SFTP; BELOW IS the entry from my ssh_config file It's prompting me for password all the time when using SFTP. pLEASE help. (1 Reply)
Discussion started by: dsravan
1 Replies
Login or Register to Ask a Question