New answers tagged

0

Hope this helps you: #!/usr/bin/expect spawn sftp USERNAME@ip_address:/path/to/folder expect "Password:" send "PASSWORD\n" expect "sftp>" send "put file1\n" expect "sftp>" send "bye\n" or if you don't want to dedicate the whole script to expect: #!/bin/sh expect << 'EOS' spawn sftp USERNAME@ip_address:/path/to/folder expect "Password:" send ...


0

If I am understanding correctly I have found that some SFTP servers don't support ssh keys and therefore rsync won't work (reports.paypal.com as an example). In that case you'll need to script doing the sftp thing, you can use expect for this... Here's a script that should work for you: #!/bin/sh bname=`basename $0` usage () #usage instructions { cat &...


0

echo "Sending files to destination" USER='(username)' PASSWD='(********)' sftp user@ip_address << EOF quote USER $USER quote PASS $PASSWD cd path put file1 bye EOF


-1

echo "ftping files to destination" USER='(username)' PASSWD='(********)' sftp user@ip_address << EOF quote USER $USER quote PASS $PASSWD cd path put file1 bye EOF


2

You can use rsync command for this kind of operations. How to use rsync to sync with a remote system Syncing to a remote system is trivial if you have SSH access to the remote machine and rsync installed on both sides. You need to set up SSH keys, it's well described how to do it here: https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-...


0

Do you have an entry for user1 in your /etc/passwd ? If you want to change the ownership of the directory you can type as root: chown apache:apache /var/www -R You can also add user1 to apache group and in this way your web server will fine. Maybe it's good idea to read the following topic: How can I create an SFTP user in CentOS?


3

Unix systems provide the chroot command which allows you to reset the / of the user to some directory in the filesystem hierarchy, where they cannot access "higher-up" files and directories. However in your case, it would appropriate to provide a virtual chroot implemented by the remote shell service. sftp can be easily configured to restrict a local user ...


0

where is password or authentication happening , For sure you have to authenticate first and then you should not get that error.


0

RSYNC behavior over SFTP Without even compressing anything, you can replicate the directory structure to the other side using LFTP (name is misleading) and the mirror subsystem of LFTP. LFTP supports SFTP and the mirror subsystem supports nearly all the capabilities of rsync. It can also split up the transfer into as many connections as you want, to make ...


1

I recommend to use zsh shell for this job: cp *(m-1) /home/oracle/SABARISH/logs/files/ where (m-1) is so called glob qualifier. In this case we select all (*) files modified (m) within (-) last (1) day.


2

You can do something like this: files=$( ls -l --time-style=+%D | grep $(date +%D) | grep -v '^d' | awk '{print $NF}' ) ; for f in $files ; do cp -rf $f /home/oracle/SABARISH/logs/files/ ; done ; sftp {user}@{host}:{remote_dir} <<< 'put /home/oracle/SABARISH/logs/files/*' or similarly: for f in $(ls -l --time-style=+%D | grep $(date +%D) | grep -...


1

For ftp use vsftpd or proftpd, while sftp functionality is included in openssh your standard ssh daemon. Check tutorials on how to change default directory to /var/www/html. Here is one for openssh https://debian-administration.org/article/590/OpenSSH_SFTP_chroot_with_ChrootDirectory . Set the default ownership of the files to something your webserver can ...


2

looks like you backed up to ~user/home/user/backup on the target machine. try (notice the extra slash signalling an absolute path) duplicity full /home sftp://user@hostname.com//home/user/backup or alternatively duplicity full /home sftp://user@hostname.com/backup . ..ede/duply.net


0

You can also use lftp: lftp -c 'connect sftp://user:password@host/dir; ls' > list.txt Or lftp -e 'ls;quit' sftp://user:password@host/dir > list.txt lftp also has a find command for recursive listing. Passing passwords on the command line is generally a bad idea. Alternative is to use ssh key authentication if possible (the password above will be ...


1

in case anyone finds rsync doesn't work (for reports.paypal.com in my case) I found the following script using expect works: #!/usr/bin/expect spawn sftp username@reports.paypal.com:/ppreports/outgoing expect "password:" send "XXXXXXXXXX\n" expect "sftp>" log_file -noappend RemoteFileList.txt send "ls -1\n" expect "sftp>" log_file send "!sed -i '' '/...


3

Yes, that should work... if your username really does start with ##. If it does, it would have to be the most bizarre username I've ever seen. In other words: are you sure this username is correct?


0

You can use lftp to do password authentication from a script. Password-less authentication can be very dangerous sometimes. Since I see that you are invoking this script for multiple servers, you will have to manually enter the passwords every time you use sftp. Instead, you can use lftp to put your password inside the script and run it as a cron-job. ...


1

It is not exactly "pipe", but you can basically tell scp to copy specific FD (which can be pipe) from your host to the other. Simple bash command like this: (scp does not work as it needs a size in advance): scp <(tar cz files to compress) host:/path/to/new.file but it can work with pure ssh: tar cz files to compress | ssh host "cat > /path/to/new....



Top 50 recent answers are included