Tag Info

New answers tagged

0

The following command works for me. paste -d'@:' <(whoami;) <(ifconfig | awk -F':' '/inet addr/&&!/127.0.0.1/{split($2,_," ");print _[1]}') <(pwd)


0

If I understand you right this should do it. Use scp with -v option. Verbose scp -rv $Blah@HOSTNAME:~/source-dir/ /local/machine/


1

The syntax for scp is: If you are on the computer from which you want to send file to a remote computer: scp /file/to/send username@remote:/where/to/put Here the remote can be a FQDN or an IP address. On the other hand if you are on the computer wanting to receive file from a remote computer: scp username@remote:/file/to/send /where/to/put scp can ...


9

The ~/SDRIVE directory is mounted as a fuse filesystem which means that the filesystem operations are handled by some userspace program, not by the kernel. Those errors are coming from the filesystem implementation, which could be anything at all and is probably some kind of site-custom software. This is one of those times where you're probably going to ...


0

On my SuSE 11 system, I found the banner message in /etc/issue.net and then remarked out the banner line in my /etc/ssh/sshd_config file. #banner /etc/issue.net Then restarted the ssh daemon service sshd restart This suppressed the banner when using scp inside scripts and cleaned up the log files.


0

What I found was that on older HP-UX machines (parisc 11.11), I had to use [^a]* But, on newer machines (parisc 11.31 and newer) it works with !(a*) This is what I ended up with. And it works: if [[ ${S_MACH} = "phd026a" || ${S_MACH} = "tht030a" ]] then scp -p -r ${S_MACH}:${S_DIR}/bin/[^a^b^c^p]* ${D_DIR}/bin/. else ...


3

On your local system, create a skeleton of what you want. For example, if you want to copy file foo to remote location /etc/foo, then you need to create an etc directory and then put foo into it. Then tar the skeleton. Now you can do this via cron as suggested by @Anthon in the comments to the question above. Step by step: On the remote host, create ...


2

Subject to certain assumptions that the target user can actually access the file in its original location, the following approach could work: SRC='/path/to/existing/file' DST='/path/to/new/file' su target_user sh -c "ln -f '$SRC' '$DST'" && rm -f "$SRC" This "moves" the file to the new user's location, but does not change the ownership or ...


0

You can su to any user, if you know there password. (for sudo you need to be a sudoer, and know your own password). So make the files readable and directory writeable(for deletion) by the other user, add files to a shared group, or use access-control-lists (ACLs) setfacl (what are the different ways to set file permissions etc on gnu/linux) Then su other ...


1

One way this can happen is files with "holes": sparse files. Suppose a program does something like: fd = open("somefile", O_RDWR); seek(fd, 1024, SEEK_SET); write(fd, "blah blah", 9); The seek() system call skips over what would be the first disk block of the file (I think, it's been a while since I've used Solaris), and writes 9 bytes in the second ...


3

I think you're just trying to copy files from the server behind NAT via gatewayserver. I'd suggest you more simple solution. Set up password-less authentication (put private key from your desktop/Mac to both mentioned servers) Use smth like ssh -MNf -L 60022:storageserver:22 username@gatewayserver to set up ssh tunnel via gatewayserver. Now your Mac's ...


0

If you look at Shell Script for logging into a ssh server you'll notice that the shebang line is #!/usr/bin/expect This is an expect script, not a bash script. You'll need to install Expect if you don't already have it.


1

for Host in `cat servers.txt` ; do scp file* $Host: ; done


2

I suppose you need: xargs -I{} scp file{01...XX} user@{}:~/ < servers.txt


1

try from user@localhost > ssh -l remoteuser remotehost "tar cf - dir_to_transfert" > remote.tar where > is the prompt ssh -l remoteuser remotehost connect you to remote host "tar cf - dir_to_transfert" perform remote tarin to standard output > remote.tar redirect ssh's output to localfile name remote.tar this will work if you are allowed ...


1

bash-completion (which is available in Cygwin, Debian, Ubuntu and no doubt many other distributions) supports scp auto-completion, as long as the shell can access the required server with no prompting (it uses ssh in batch mode, see the ssh_config(5) manual page for details). The easiest way to enable this is to use ssh-agent. This is probably enabled by ...


1

Zsh has remote scp completion, but you need to make sure that you don't use an alias to some wrapper function like the non-official glob_scp, or if you have one, it is possible to add the same completion mechanism like: compdef glob_scp=scp You'll note that zsh will correctly quote special characters such as * when needed (though this may look strange). ...


4

Something I use fairly often when there is no connection possible between the two servers scp -3 user@server1:/path/to/file user@server2:/path/to/file source -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 ...


1

Firstly you need to check i you are able to ssh to server2 without any error, if you get the same error, then please open the file ~/.ssh/known_hosts and search the server2 key and delete it. Then check if you are able to ping the server by the host name If not then please edit both the server host file as mentioned below #vi /etc/hosts server1 ...


8

Yes this is possible, but only if server1.com can reach server2.com by using that name. If not you will probably get a message: ssh: connect to host server2 port 22: Connection refused The man page for scp clearly states that it copies between hosts on a network and that: Copies between two remote hosts are also permitted. What you should do (once) is ...


0

Check if ~/.ssh/known_hosts have proper records for both servers Check also if server1 have proper ~/.ssh/known_hosts record for server2


1

Do you start from host1 or host2? in which case there is a redundant host_, also if both user are the same, and same from starting host, user@ is redundant. To sum up, assuming you start from host1 copy content of id_rsa.pub to the authorized_keys on host2 to fetch remote file (remote to local) scp -i /home/user/.ssh/id_rsa host2:/tmp/somedistantfile ...


0

Here a simple example: #!/bin/bash files_to_copy='' destination_directory='' while (("$#")) ; do if [[ "$@" = "$1" ]] ; then # last argument destination_directory="$1" else # argument files_to_copy="$files_to_copy $1" fi shift done scp user@remote.server:"$files_to_copy" $destination_directory; If you run ./example.sh foo.pdf ...


-1

The main idea is to prepare string with the list of files to operate (even through the loop) than transfer the string to command: sloc='/some/location' unset flist for i in "$@" do flist[${#flist[*]}]="$sloc/$i/$i".pdf flist[${#flist[*]}]="$sloc/$i/$i".txt done scp user@remote.server:"${flist[@]}" /somewhere/else/


4

Try this way: cpfromserver () { files='' for x in "$@" do files="$files /some/location/$x/$x.txt /some/location/$x/$x.pdf" done scp user@remote.server:"$files" /somewhere/else/ } Important caveat from comments: "It's worth noting for posterity that this solution definitely won't work for complicated filenames. If a filename ...


0

use a bogus ProxyCommand ... $ ssh -o 'ProxyCommand echo %h>&2' mYaLiAs 2>&1 | fgrep -v ssh_exchange_id | read actual $ echo $actual 192.168.1.234


1

I take it you’re using a Mac and copying to/from a Raspberry Pi, is that correct? (Not that it matters particularly, it’s just so my explanations are clearer.) Regardless of the “direction” of the copy, scp always asks for the remote password. You’re running commands on your Mac, so you’ve already proved that you know how to access the local end (the Mac); ...



Top 50 recent answers are included