File transfer using SFTP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File transfer using SFTP
# 8  
Old 06-10-2014
Hi,

I'm using Ubuntu 10.04 LTS.

I checked the set up of passwordless authentication in this way:
Quote:
$ssh <ip>
.When i excecuted the above command it din't ask me for any password. So i thought it might be passwordless authentication is set up alreday.Am i verifying the passwordless authentication in a right way?

Where can i find the logs related to sftp or ssh. I searched bfor /var/log/secure but dint find it.

Also executing the sftp caommands manually to transfer the file from remote to local not giving any error but the thing is asking for the password as passwordless authentication is not properly set.

When i write the bash script where in i used sftp commands to transfer the file. Here also i'm not getting any error and file is being transferred sucessfully but asking for the password due to authentication.

So how can i set the passwordless authentication and verify it.
One more query is if i go for passwordless authentication does it affect other things as multiple users are using the same ubuntu machine and alos hadoop is installed on this machine. So enabling passwordless authentication will affect other things or it is only applicable for my work?
I'm bit confused here.

Thanks,
Shree

---------- Post updated 06-10-14 at 01:30 AM ---------- Previous update was 06-09-14 at 11:46 PM ----------

Hi,

I got the steps to create passwordless login to a remote machine from local machine.
Below are the steps:
Code:
localserver# mkdir ~/.ssh
localserver# cd ~/.ssh
localserver# ssh-keygen -t rsalocalserver# ssh user@<remoteserver_ip>
Password: 
localserver# ssh user@<remoteserver_ip> mkdir -p .ssh
localserver# cat .ssh/id_rsa.pub | ssh user@<remoteserver_ip> 'cat >> .ssh/authorized_keys'
localserver# ssh user@<remoteserver_ip> "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
localserver# ssh user@<remoteserver_ip>

In the above steps, in which location do i need to create the ssh directory on local and remote machine.I already have ssh directory on this path /etc/ssh both on local and remote machines. So do i need to create ssh directory in the differen tlocation or do i need to use the ssh directory already existing?In case if i use the existiong ssh directory does it overwrite the existing contents with new contents? Please clarify the above queries.

Thanks,Shree

Last edited by shree11; 06-10-2014 at 03:55 AM..
# 9  
Old 06-10-2014
If you want to run that using your ID, create '.ssh' folder in your home directory
else, create in the respective application / functional ID's home directory
# 10  
Old 06-10-2014
Hi Srini, I dint get "If you want to run that using your ID, create '.ssh' folder in your home directory" . Here ID in the sense?I'm accessing ubuntu using putty.
# 11  
Old 06-10-2014
I mean user (username)
# 12  
Old 06-10-2014
One more query is can we have multiple ssh directories one created under root user in the path /etc/ssh and other created using user user in the path /home/user/ssh ? Do they conflict each other?

In my case i have ssh folder created under /etc and under ssh i have the following files:
Quote:
moduli
ssh_config
ssh_host_dsa_key
ssh_host_rsa_key
sshd_config
ssh_host_dsa_key.pub
ssh_host_rsa_key.pub
So after login to user useranme can i excecute the $ssh-keygen -t rsa command inside /etc/ssh folder? So doing this will overwrite the existing ssh_host_rsa_key.pub file or it will make a new public key entry at the end of the file?
# 13  
Old 06-10-2014
So, the public key needs to be accepted on the server by the user you are connecting to. You seem to have the instructions to do this. Can you sign on without a password as that user?:-
Code:
ssh user@host

If it prompts for a password, do you know it? If so, put it in then have a look on the remote server at the permissions for the .ssh directory in that users home directory and the files within it. It must be owned by the account you've logged on as and it's best to keep them all as RW only to that owner, with no other access. The .ssh directory itself will need to have RWX though.

Note that the /etc/ssh is for the overall service, not your login certificates. Using ssh-keygen will (by default) work on or create the .ssh directory in your home directory.



Robin
# 14  
Old 06-12-2014
Hi,

I tried generating public and private keys on local machine. Also copied the id_rsa.pub to the remote machine and renamed to authorized_keys.

Also set the permissions to the .ssh and authorized_keys as below:
chmod 640 authorized_keys
chmod 700 .ssh

But still when i do :
$ssh remoteserver@<ip>, it is asking for the password. The passwordless login is not yet enabled.Not getting where it's going wrong.

Thanks

---------- Post updated at 04:06 AM ---------- Previous update was at 03:47 AM ----------

Hi,

I'm able to transfer the file from remote machine to loac server with passwordless login.

Thank you.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need some help regarding file transfer between server (sftp/scp)

Hi All, Need some help regarding file transfer between server. Suppose we have system-A and system-B. To transfer file from system-A to system-B we usually share the public keys of system-A to system-B and do scp/sftp to transfer a file. Is it possible that public key of system-B can be... (3 Replies)
Discussion started by: abhi_123
3 Replies

2. UNIX for Dummies Questions & Answers

Transfer image file from local to remote with sftp

Hi. I have managed to transfer a file from remote to my raspberry pi, but I have the camera mounted on the Raspbien so I would like to transfer the image the other way. I use this line: sshpass -p 'PASSWORD' scp -- USER@ssh.servername.com:/www/cam/image.jpg /home/pi/shared/web/image.jpg (4 Replies)
Discussion started by: brickglow
4 Replies

3. UNIX for Dummies Questions & Answers

SFTP File transfer issue

Hi guys, Need a quick and urgent help on below issue. One of our application is try to transfer the file to another host thru sftp process My file is about 1 GB. Job is getting hung while transferring the file. So when I login as sftp and check the file system space is only in MB... (2 Replies)
Discussion started by: Vinoth Kumar G
2 Replies

4. Shell Programming and Scripting

Passwordless file transfer using sftp

Hello all, I have a requirement, in which we need to stage a package to Unix remote server in an automation (we cant use ssh key generation) , do u have any idea how we can transfer the package to remote server using sftp .if you have any script plz share it to me (4 Replies)
Discussion started by: Ramji Sundaram
4 Replies

5. Shell Programming and Scripting

Shell script to transfer file via SFTP

Hi all, I'm trying to do a script to transfer file between my server and an external server via SFTP protocol. It doesn't use rsa key, but password. When I run the script, it throw back a prompt that request me to put the password. How should I do for automatic login? Pleaes help :( ... (2 Replies)
Discussion started by: Kapom
2 Replies

6. Shell Programming and Scripting

SFTP with ASCII file transfer

Hello - I have text file and need to load the data in Oracle through sqlloader. I need to move this file to unix server and load into oracle. When i SFTP(unfortunately i do not have FTP) to unix box, each line is appended with ControlM character... since it is transferring in BINARY... (4 Replies)
Discussion started by: govindts
4 Replies

7. Shell Programming and Scripting

SFTP file transfer mode question

I am having trouble viewing a file in ASCII after doing a 'get' using SFTP. It appears to have come across as machine language. Does the file have to be in ASCII format prior to the 'get' or is there a way to convert it to ascii after I get it onto my server? I have read where the secure file... (0 Replies)
Discussion started by: wsiefkas
0 Replies

8. Shell Programming and Scripting

sftp file transfer

hi i am trying to login to remote server using SFTP Protocol and trying to upload a file butit is asking for the password. Note: I am trying to connect to FrontEnd server sftp SFTREGUP1@14.71.26.6 Connecting to 14.71.26.6... Password Authentication Password: Please help (14 Replies)
Discussion started by: Satyak
14 Replies

9. HP-UX

SFTP Protocol: How to transfer the file in PC Format

Hi, We are facing issue with files transfered using SFTP in Hp-UX. The transfered files are in Unix Format. That is, file format as UNIX (LF) instead of a PC format (CR & LF). How can we achieve file transfers as PC format using SFTP? Your help and input will be highly appreciated. ... (2 Replies)
Discussion started by: brap45
2 Replies

10. UNIX for Advanced & Expert Users

sftp command for file transfer

hi, I need to sftp a file from one unix system to another unix system. eg: filename is test.txt servername : abc@xyz please give me the sftp command for that. thanks in advance.. mohan.p (2 Replies)
Discussion started by: mohanpadamata
2 Replies
Login or Register to Ask a Question