How to give passwd along with sftp.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to give passwd along with sftp.
# 1  
Old 03-08-2007
How to give passwd along with sftp.

Hi,

I need to transfer files to remote host using sftp.

How to give pwd along with sftp.i.e while script runs it should not prompt for password.

sftp <username>@<hostname>

How to add passwd?

Thx
# 2  
Old 03-09-2007
You have two choices, first one is to setup a key-based authentication between the appropriate users on the two systems involved, or the second is to download the source and compile the psftp and pscp clients. They are part of the putty family and will allow the password to be 'fed' in a manner similar to ftp.

But as always, remember that plaintext passwords in files are a bad idea.
# 3  
Old 03-09-2007
Quote:
Originally Posted by Mar1006
Hi,

I need to transfer files to remote host using sftp.

How to give pwd along with sftp.i.e while script runs it should not prompt for password.

sftp <username>@<hostname>

How to add passwd?

Thx
depending on your implementations, sftp has a -b option. check your man page
example
Code:
sftp -b test.batch user@server.com

test.batch contains the following data.
Code:
      user_password
      get file
      quit

just an example. the rest you have to try on your own.
# 4  
Old 06-11-2008
It's not working for me.
even i did same mentioned above

plz can body help me...
# 5  
Old 08-06-2008
Log in as the User

Make sure you are in the Users Home Directory

pwd

Build the key

ssh-keygen -t rsa

(accept the defaul filename)
(leave the passphrase blank)

Change directory to ssh

On the Local machine...

cd .ssh

scp remote-host:.ssh/id_rsa.pub remote-host.key

cat remote-host.key >> authorized_keys

(Replace remote-host with server-name)

Once keys are built your sftp will not require a passphrase.
# 6  
Old 12-06-2008
Java

Hi Tmills,

Thanks for your post.. I have got my problem resolved.. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automated passwd protected sftp

I am trying to automate the process using password protected sftp upload the file in daily basis from our server to client server and exit successfully from remote server Getting issue while running the script. sftp test@12.342.564.205/passwd--password for sftp cd /home/group/jagu/txt put... (3 Replies)
Discussion started by: jagu
3 Replies

2. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

3. UNIX for Dummies Questions & Answers

For SFTP connection - How to give password in UNIX Script (ksh)

Hi, I am not able to give the password in Unix script for SFTP connection. When I am trying to manully SFTP command for accessing the server , it asking for pwd and I could provide the pwd but I am not getting how to provide the pwd inside the Unix script. sftp -v user@xyz.com. ... (4 Replies)
Discussion started by: Vineeta Nigam
4 Replies

4. Red Hat

Chroot sftp users, remote sftp login shows wrong timestamp on files

Hello, I have a weird issue, I have RHEL 5.7 running with openssh5.2 where sftpgroup OS group is chroot. I see the difference difference in timestamp on files, when I login via ssh and SFTP, I see four hour difference, is something missing in my configuration. #pwd... (8 Replies)
Discussion started by: bobby320
8 Replies

5. AIX

When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?

Does anyone know when AIX started using /etc/security/passwd instead of /etc/passwd to store encrypted passwords? (1 Reply)
Discussion started by: Anne Neville
1 Replies

6. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

7. Solaris

passwd cmd reenables passwd aging in shadow entry

Hi Folks, I have Solaris 10, latest release. We have passwd aging set in /etc/defalut/passwd. I have an account that passwd should never expire. Acheived by emptying associated users shadow file entries for passwd aging. When I reset the users passwd using passwd command, it re enables... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

8. Shell Programming and Scripting

how to give sftp a password in a shell scripit

I want to write an sftp script, but I can't put ssh keys on my destination. Is it possible to pass sftp a password inside a script? I know that the -b option makes sftp use a file for params. Can the password go in such a file? How can I do this? Thanks in advance (3 Replies)
Discussion started by: kskywr
3 Replies
Login or Register to Ask a Question