scp +find


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users scp +find
# 8  
Old 11-13-2006
You are right. You can scp with *, but the OP wanted a certain bunch of files only, the ones that came out as the result of his find command. Hence the sftp batch script.
# 9  
Old 11-13-2006
scp

yup, i agree with ya, i am just posting for informational purposes.

-S
# 10  
Old 11-14-2006
Thanks for your posts!!!
...but the problem is that I can't use for my project sftp... Smilie (I can't install the sftp server on the management log server).
I give you more details about my project:
I must realize script with this tool:
- Scripting language: PERL
- Remote command execution: EXPECT
- Remote shell: SSH
- File transfer: SCP

The log archiving should do the following tasks:
-Connect to the management log server from a sun solaris server and order a log switch every day at midnight.
...
- Log files older than 15 days must de retrieved from the firewall management server using scp, then the log will be archieved automatically.
...

Thanks sincerely for your prompt replays. Have a good day.
M.
# 11  
Old 11-14-2006
If you can do 'scp', then you can do 'sftp'. Try it.
# 12  
Old 11-14-2006
another option ...

create a script that does what you need on the remote server --- replace the logfile, finds the files based on your criteria and makes a list of it in a predetermined directory ... have a cron job to run that script on the remote server a certain time (i.e., 12 midnight) ...

after a predetermined time, run the command below on the local server to get the files --- substitute the correct values for the variables ... you might want to test and play with the escapes as i can't test right now ...
Code:
ssh $remserver "cd /$remdir; tar cvfp - \`< /$remfilelist\`" | (cd /$localdir; tar xvfp -)

good luck!
# 13  
Old 11-14-2006
If I execute:
$ sftp fwtest

I obtain:

Connecting to fwtest...
Request for subsystem 'sftp' failed on channel 0
Connection closed


I attach the configuration of sshd_conf:

$OpenBSD: sshd_config,v 1.59 2002/09/25 11:17:16 markus Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

#Port 22
Protocol 2
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 3600
#ServerKeyBits 768

# Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
LogLevel INFO

# Authentication:

#LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# rhosts authentication should not be used
#RhostsAuthentication no
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
IgnoreUserKnownHosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

#AFSTokenPassing no

# Kerberos TGT Passing only works with the AFS kaserver
#KerberosTgtPassing no

# Set this to 'yes' to enable PAM keyboard-interactive authentication
# Warning: enabling this may bypass the setting of 'PasswordAuthentication'
#PAMAuthenticationViaKbdInt no

X11Forwarding no
AllowTcpForwarding no
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
PrintMotd yes
#PrintLastLog yes
KeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression yes

#MaxStartups 10
# no default banner path
#Banner /some/path
#VerifyReverseMapping no

# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server

DenyUsers root shutdown halt nobody ntp pcap rpm
AllowGroups root


In /usr/libexec/openssh/ I haven't the sftp-server file... Smilie
# 14  
Old 11-14-2006
the tar command thru ssh will do the file transfer securely as it will on scp so why can't you try that? there are more than a few ways to do things in unix and as long as what you're doing gets the job done and falls within the requirements --- there is no rule that says you have to do things a certain way ...

unless i'm missing something, you're required to use scp to do the file transfer because it happens thru an encrypted channel and it doesn't need a password ... the ssh-tar option will do the same thing --- as will ssh-cpio and ssh-ufsdump, etc. ...

anyways, good luck!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ssh find and scp

Hello All, I have a requirement to copy few files from remote server to local, and below are the sequence ssh to the remote host finding the files with the specific condition once found scp to the local server path for (( i=0; i<${tLen}; i++ )) do ssh... (1 Reply)
Discussion started by: nextStep
1 Replies

2. Shell Programming and Scripting

SCP

Hi All, Please help on the below command scp -r 'directory name'inrvgo@IP:/export/home/muthu/prod_12-09-2010 I am trying to copy a directory from one server to another server using the above command but its displaing the error (missing destination file) but the diectory was there in the... (1 Reply)
Discussion started by: thelakbe
1 Replies

3. Red Hat

scp with su

Hi Friends, I am trying to copy some files over the network in between my linux servers. I am using scp command for this. by default direct ssh root login is disabled on all of my linux servers. Normaly we used to login as a normal user and the su to th root user. unfortunately root user is... (1 Reply)
Discussion started by: arumon
1 Replies

4. Shell Programming and Scripting

find -exec scp

Hello, I'm facing a problem with a command that works on Linux but not on Unix (Solaris 10). I want to find files and scp then to another server. This command is: find /path -type f -exec scp {} root@node000C76211737:{} \; All the files are found correctly but it looks like the last... (7 Replies)
Discussion started by: Tex-Twil
7 Replies

5. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 Replies

6. Shell Programming and Scripting

Is this possible with SCP?

I normally download a directory recursively using: scp -r <name>@host:<path> . This has worked fine. As everyone knows this will download all of the directory named in <path> and all of the sub directories. I would like to know if it is possible to not download a particular file if it... (5 Replies)
Discussion started by: cpabrego
5 Replies

7. Shell Programming and Scripting

What is scp-ed over?

Hi all, i have a directory in server A. the directory path is /home/kevin. I need to scp the directory to another server B. i would like to ask, when i do a scp of the /home/kevin , i can expect all the files from A to go B. However, how about the hidden files? for example the ssh keys in the... (4 Replies)
Discussion started by: new2ss
4 Replies

8. UNIX for Advanced & Expert Users

Scp

I am trying to transfer a 10g files using scp, but I am getting timeout errors is there anywhere that I can modify a config file or something to increase the time. (4 Replies)
Discussion started by: rbizzell
4 Replies

9. UNIX for Dummies Questions & Answers

scp

How do i use scp to copy a file from my home directory on a server I am logged into, to the computer I am using? I thought it would be something like: scp filename mycomp.company.org Thanks. (2 Replies)
Discussion started by: ignus7
2 Replies
Login or Register to Ask a Question