Tag Info

New answers tagged

0

If scp were working, then you'd be able to run this: scp remotehost:/path/to/remote/file /dev/stdout


3

Curl can display the file the same way cat would. No need to delete the file since it simply displayed the output unless you tell it to do otherwise. curl -u username:password sftp://hostname/path/to/file.txt If you use public key authentication: curl -u username: --key ~/.ssh/id_rsa --pubkey sftp://hostname/path/to/file.txt If you use the default ...


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



Top 50 recent answers are included