Tag Info

New answers tagged

1

Here's a simple way that doesn't preserve metadata: ssh server.example.com 'set -C; cat >/path/to/remote/file' </path/to/local/file You can do it with rsync with the right options. The return code will be 0 if the file exists, but you can find out from the verbose output instead. changes=$(rsync -a --ignore-existing --itemize-changes \ ...


-1

Check if the file exists on the remote host first: if ! ssh remotehost [ -f incoming/DB1026910.sql ]; then scp DB1026910.sql remotehost:incoming/ fi


1

Physically go to the remote_host and change the file owner to remote_user. sudo chown remote_user /path/to/file Then you should have permissions to copy the file.


1

From man scp: -p Preserves modification times, access times, and modes from the original file. You can see the -p option does not preserve ownership. If you want to preserve file ownership, you can use rsync with -o and -g, which will preserve owner and group. This requires you to run rsync as root.


2

When you scp, the ownership comes from the user you use to scp to the other machine. For example:- scp FILENAME USER@HOSTNAME:/PATH/TO/DESTINATION/ The ownership of FILENAME at the host HOSTNAME after scp will be USER as owner and primary group of USER as its group ownership.


2

If you can access from machine B to A & C, Newer version of scp support the -3 switch, which allow you copy a file between 2 remote machines. -3 Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts. Note that this option disables the ...


0

There is a very simple way to do this! First connect to the gateway: ssh user@B Launch the copy C -> A ssh user@C "dd if=/path/source/file" | ssh user@A "dd of=/path/destination/file" If you want to get rid of the messages written by dd on stderr, either use the option status=none if your version of dd supports this, or use 2> /dev/null. Note ...


0

If you have configured SSH-access on all machines, you can setup SSH-tunnel via machine B. First step: [user@A ~]$ ssh -f -L LOCALPORT:IP_ADDR_C:22 user_at_B@IP_ADDR_B Key -f put ssh to background just before command execution. Good idea to use -N key. From man ssh: -N Do not execute a remote command. This is useful for just forwarding ports ...


0

You can establish an ssh tunnel from B to C, then from A scp to B's port, where the tunnel serves to download the file. There are many information pages, Google for them, one of the first searches took me here.


0

You can find the answer in this link http://serverfault.com/a/37646


4

You can authorize as many public keys as you like on the server side. Furthermore, you can restrict a key to a specific command on the server side. So generate an SSH key pair on the client, and don't put a password on the private key. Append the public key to the list of authorized keys, and add a command restriction. ssh-keygen -t rsa -f ...


0

You can either use ssh-keygen procedure as suggested in comment and answered here. For a longer version you can use even this link Linux Cookbook. It can open a security hole if you use shared account on your machine (everybody from that account can access to all the machine for which you did the ssh-keygen authentication). write a little script that ...


1

Following an article from here: You should setup SSH connection without Password Using ssh-keygen then it will allow you to use scp without prompting password or any other remote task: 3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id You can login to a remote Linux server without entering password in 3 simple steps ...


3

I would recommend creating a private/public key pair on the client machine, and copying the public key to the remote machine. You can generate such a keypair with ssh-keygen and copy it to the remote machine using ssh-copy-id. The logs are probably readable by all user accounts on the server (at least they are on my machine). You should therefore not use ...


0

I tried to give some examples in the following article. Basic idea is not use scp, but use dd and ssh with sudo user switch. Look: http://hmmss.wordpress.com/2014/07/02/ssh-and-scp-with-another-user


1

I would recommend a full terminal emulator for Windows like Cygwin, MobaXterm, or BitVise. Cygwin will let you SSH and SCP from the command line. MobaXterm has a built in file transfer pane that will follow the command line's working directory. Like Moba, BitVise offers a terminal and a graphical interface for moving files to and from the remote system. ...


0

Here is the final script that worked for me. Thanks to the input from @Ricky Beam and @arielCo. use File::Spec; my $escaped = $component_name; $escaped =~ s/(\s)/\\$1/g; # scp-from-path my $scp_from = File::Spec->catdir($REMOTE_MV_HOME, $escaped,'*'); # scp-to-path my $scp_to = ...


1

Putty in itself doesn't support file transfers in the way that you want. You would need to download, install and use PSCP and PSFTP (from PuTTY). There are other clients too such as WinSCP, Filezilla which may suit your needs better.


1

Putty is a terminal client providing you a way to execute commands and view their output on the remote machine. It is not a file transfer client. There is an SCP program in the same family of tools for Windows called PSCP, but it is command line focused for use in a windows console and might not be the easiest place to get started. Instead I would recommend ...


0

First, are you sure that scp supports remote-to-remote transfers? As far as I know, some versions do it with the -3 switch. Anyway, I keep this script handy for whenever I have trouble with arguments: #!/usr/bin/perl my $count; for (@ARGV) { s/([\x00-\x1F\x7F])/'\x'.unpack('H*',$1)/ge; printf "%d: '%s'\n", ++$count, $_; } Let's try your code: $ perl ...


2

What am I doing wrong? Using system. That will fork a shell with the rest of your args as options. In other words, sh is eating the quoting. Try: system 'scp', '-vr', '--', '"root@'.$HOST.':'.$scp_from.'"', '"root@'.$HOST.':'.$scp_to.'"' ;`


0

The reason why you are getting this is because you have not put in the ditectory the file is in. Try: scp rrtigga@pc35.cs.ucdavis.edu:~/CPUTimer.h /Users/Spicycurryman/Desktop


0

You can try this scp -r username@xx.xx.xx.xxx:/remote/dir/path/ /local/dir/path/. For example,If I want to copy a file called sample.txt residing in home directory of remote system z having IP ab.ab.ab.cde to my local system l path ~/Desktop/ then the command will be scp z@ab.ab.ab.cde:~/sample.txt ~/Desktop/. You can suffix -r to scp to copy the directories ...


1

sftp is a useful alternative for transferring files and archives over SSH. Start a connection while in your target directory and use FTP commmads to transfer files. $ sftp user@host Connected to host sftp> cd /usr/local/src sftp> pwd Remote working directory: /usr/local/src sftp> put file.tgz sftp> get file.tgz


2

If you know the name of the file(s) you want to copy, there is no need to ssh to the remote server before using scp to copy the file(s). This should do the trick: scp rrtigga@pc35.cs.ucdavis.edu:~/CPUTimer.h . This will copy the file CPUTimer.h from the home directory of rrtigga on pc35.cs.ucdavis.edu to the present working directory on the local ...


1

You don't have to give an absolute path to scp — the easiest way to deal with this is to go where you want to put things and use scp rrtigga@pc35.cs.ucdavis.edu:CPUTimer.h . (. refers to the current directory), or give a relative path like Desktop. You can also use ~/Desktop to refer to the Desktop directory within your home directory from anywhere. If you ...



Top 50 recent answers are included