Sftp education needed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sftp education needed
# 1  
Old 04-01-2013
Display Sftp education needed

I have a program running on unix that creates a text file as part of a triggered event. the text files are written to the same directory everytime. There are 15+ users that could possibly be creating the files.

Once the file is created, I need to move the file to a third party system.
the only control/access for this system i have is a username, password and IP address. This server can be accessed by SFTP. I can SFTP the server and provide the password, and execute whatever commands are needed.

question 1 : the user name given to me by the third party is 15 characters long.
and as far as i can see, unix will only allow 8 characters.

when generating the keys (ssh-keygen) on our side, do the names have to match.

question 2: there seems to be a lot of different opinions on what the file permissions for the .ssa directories and files should be on both the host and client. any information in this area would be useful
# 2  
Old 04-01-2013
1. I don't think 8 is the limit.

Code:
# id 1234567890123457890
uid=509(1234567890123457890) gid=509(1234567890123457890) groups=509(1234567890123457890)

Code:
# sftp 1234567890123457890@106.0.0.31
Connecting to 106.0.0.31...
1234567890123457890@106.0.0.31's password: 
sftp>

2. This is a working setup.
Code:
# ls -lrtd .ssh
drwx------ 2 root root 4096 2013-03-18 20:14 .ssh
# ls -lrt .ssh
total 24
-rw-r--r-- 1 root root 236 2013-02-09 21:27 id_rsa.pub
-rw------- 1 root root 887 2013-02-09 21:27 id_rsa
-rw-r--r-- 1 root root 381 2013-03-18 19:56 authorized_keys
-rw-r--r-- 1 root root 381 2013-03-18 20:14 authorized_keys2
-rw-r--r-- 1 root root 612 2013-04-01 21:26 known_hosts
#

Sometimes, have a permission of 600 for authorized_keys may help.
And NO, the username doesn't have to match while generating the ssh-keys.
If you are having trouble setting up the ssh connection, you can run the sshd in foreground with debug enabled. Mostly, that should help if there are any permission related issues.

HTH

--ahamed

Last edited by ahamed101; 04-01-2013 at 08:20 PM..
# 3  
Old 04-02-2013
sftp education continued

thanks for the info.

i think i need to step back and get a better understanding of what is actually happening with the sftp setup

i have setup the following on 2 inhouse unix boxes:

1 client1 will be connecting to target@unix-2, to send files

on client1
created the user client1 (/usr/exec/usrdir/client1) (home)

mkdir .ssh at /usr/exec/usrdir/client1

keygen -t rsa <ENTER> for default directory (home)
<ENTER> <ENTER> at passphrase questions (this will be used from a
shell script to login and send the files to the other machine

on the unix-vm machine:
created the user target (/usr/exec/usrdir/target)
mkdir .ssh

copied the file id_rsa.pub from client1 to /usr/exec/usrdir/target/.ssh on the unix-vm machine

on the unix machine: cat id_rsa.pub >> authorized_keys

from the client1 machine: attempt the command: sftp target@unix-vm

but this still results in being prompted for the password

debug1: next auth method to try is publickey
debug1: try privkey: /usr/exec/usrdir/client1/.ssh/id_rsa
debug3: no such identity: /usr/exec/usrdir/client1/.ssh/id_rsa
debug1: try privkey: /usr/exec/usrdir/client1/.ssh/id_dsa
debug3: no such identity: /usr/exec/usrdir/client1/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: next auth method to try is password
target@unix-2's password:


you mentioned using sshd to debug to find why this is failing. I am starting to play with this but am getting errors about not be able to load the host keys, these particular files under /etc/ssh have not been modified and are the original files from the OS installation, any suggestions......

Jeff
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

2. Shell Programming and Scripting

Help needed to setup SFTP

Hi Gurus, We need to make SFTP in non_interactive mode. I have done steps like key generation, copying public key into destination server, changing file/folder permission. Still we are not able to achieve it. Please check the log below.... $ sftp -v b2cint@10.76.120.120 Connecting to... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

3. Shell Programming and Scripting

SFTP script help is needed

Hello all and Happy 2010! I have following problem and I do not have a full solution yet. Maybe someone of you could help .... I have remote sevrer A and I am connecting from my local server via SFTP to download .TXT files. -Files are dropped at random times into download folder on server A... (7 Replies)
Discussion started by: kalimero
7 Replies

4. UNIX for Dummies Questions & Answers

Help needed for listing files using SFTP

Hello All I want to list files using SFTP. this should work the same way as ls -Ap1t $dir is working in a perl program. but for SFTP i dont find any option like as A,p,1,t.so how to use this (0 Replies)
Discussion started by: vikas_poonia
0 Replies

5. Shell Programming and Scripting

sftp script needed for solaris box

Hi , I have a solaris box through which i need to connect to ATM's and pull files using sftp. I did same type of scripting using ftp before but no sftp.The problem now i am facing is, i want to put the password along with this sftp (non-interactive) script. Unfortunately there is no... (3 Replies)
Discussion started by: Renjesh
3 Replies

6. UNIX for Dummies Questions & Answers

Sftp Help Needed!!!!!!!

Thank you for the help (2 Replies)
Discussion started by: scooter17
2 Replies

7. Shell Programming and Scripting

sftp script needed

Hello all, need help to write a smal script to send files to remote sys using sftp @ HP UNIX environment. Thanks (1 Reply)
Discussion started by: ravi.sadani19
1 Replies

8. UNIX for Dummies Questions & Answers

Support Needed: Education On Hold

I'm Presently Writting A College Report On Operating Systems, Not Enjoying It Very Much. I Was Hoping Someone Could Direct Me To A Site Where I Could Get Information Such As The Role Of Operating Systems, Types Of Operating Systems (Multi-User Multi-Tasking etc), Modes Of Operating systems... (3 Replies)
Discussion started by: OSNovice
3 Replies
Login or Register to Ask a Question