SCP files from an IP - putty

I have a folder of files on an IP that I want to download.
Can I do this using PUTTY?
I've tried using
scp user#servername:/home/folder-to-download C:\temp\
but it doesn't seem to work

If you're using putty, the command is pscp. Paul's -r tip is also relevant:
pscp -r user#servername:/home/folder-to-download C:\temp\

You need to make it a recursive copy:
scp -r user#servername:/home/folder-to-download C:\temp\
See the scp man page for a list of possible options, including -r.

Related

What would be the best way to download a list of files from a server?

I have a list of SWF files that I want to download to my PC. Is there a quick way to do this from my server, like using WGET or something similar. Each file line list is a new line:
http://super.xx-cdn.com/730_silvxxxen/v/v.swf
http://super.xx-cdn.com/730_sixxxxheen/73xxxxversheen.swf
http://super.xx-cdn.com/730_rxxxd/v/v.swf
There are thousands of lines.
If you use ssh over putty to access your server you could easily use winscp from putty
otherwise you could also use pscp
If you do not have putty installed get it and make up a ssh to your server
Another easy way to download them is just getting an FTP client and download them over FTP
You can use simple SH script, if I correctly understand your question:
#!/bin/sh
while IFS= read -r line
do
wget $line
done < "urls.txt"

How can I FTP many files I have listed in a TXT?

I have a list of files inside a TXT file that I need to upload to my FTP. Is there any Windows Bat file or Linux shell script that will process it?
cat ftp_filelist | xargs --max-lines=1 ncftpput -u user -p pass ftp_host /remote/path
You can use the wput command.
The syntax is somewhat like this
wput -i [name of the file.txt]
Go through this link
http://wput.sourceforge.net/wput.1.html
It works for linux.With this it will upload all the URLs given in the text file onto your ftp server one by one.
You may want to check out Jason Faulkners' batch script about which he wrote here.

bash command to copy file from one computer to another

Wasn't quite sure how to word this but let's say I've used ssh to remote into my friends MacBook (macbook_b) from my MacBook (macbook_a).
What command would I use to copy a file/directory to my MacBook (macbook_a) from my friends MacBook (macbook_b)?
Thank you.
You can use scp (Secure Copy).
To copy FROM your machine to friends:
scp file_to_copy user#remote.server.fi:/path/to/location
In another direction:
scp user#remote.server.fi:/path/locatio/file_name file_name
If you need to copy an entire directory, you'll need to use the recursive flag, like this:
scp -r directory_to_copy user#remote.server.fi:/path/to/location
Assuming you're logged in on macbook_b:
scp file_to_copy username#macbook_a:/path/to/destination
or if you're logged in on macbook_a:
scp username#macbook_b:/path/to/file_to_copy local_destination
I think this link would help you with the answer you are looking for. In this you can use scp ssh source destination example for your scenario you have requested for.
Also refer to this question which has been already answered. It might help.
first do pwd to get the path to the file of your friends macbook then
go into your machine's ssh window and do
scp user_name#machine_name(of your friend's):(copy the path after executing pwd)/file_name .(dot means your your current directory)
enter his password !
voila !!!

Rename multiple files using ftp

I have a set of files in my ftp folder. I have access to only ftp mode. I want to rename those files with extension .txt to .done
Ex:
1.txt, 2.txt, 3.txt
to
1.done, 2.done, 3.done
Only rename command is working in this ftp. I am expecting something like
rename *.txt *.done
to rename them all in a single command.
In short: You can't.
FTP is very basic and does not support mass renaming. You can either write a small script for it, or download some helper software, such as the one here.
Hallo to all,
Even if the question is quite old, I think could be usefull for others to read my suggestion.
I found a great and easy solution combining curlftpfs, "A FTP filesystem based on cURL and FUSE" as they define it, and rename linux and unix multi rename tool.
I tested on linux mint 17 (and I think it should work in other debian based distributions)
install curlftpfs
sudo apt-get install curlftpfs
create the mount folder
sudo mkdir /mnt/ftp_remote_root
mount remote ftp on folder
sudo curlftpfs -o allow_other -o user="USERWITH#CHARACTERTOO:PASSWORDTOACCESSUSER" ftp://my_ftp_server.com /mnt/ftp_remote_root/
jump into desired ftp remote folder
cd /mnt/ftp_remote_root/path/to/folder
rename as you need files (-v shw new names, -n show interested files, omitt them to rename files)
sudo rename -v -n 's/match.regexp/replace.regexp/' *.file.to.change
It could took few seconds because it works on network.
I think it is really powerfull and easy to use.
Let me know if you find any problems.
Bye
Lorenzo
try something like this:
the following example move/rename files on the FTP server
for f in $(lftp -u 'username,password' -e 'set ssl:verify-certificate
no; ls /TEST/src/*.csv; quit' ftp.acme.com| awk '{print $9;}'); do
lftp -u 'username,password' -e "set ssl:verify-certificate no; mv
/TEST/src/$f /TEST/dst/$f; quit" ftp.acme.com; done
note: use .netrc to store username and password.
Use the following command:
ren *.txt *.done

Rsync on Windows: wrong permissions for created directories

I'm trying to push changes to my server through ssh on windows (cygwin) using rsync.
The command I am using is:
rsync -rvz -e ssh /cygdrive/c/myfolder/ rsyncuser#192.168.1.110:/srv/www/prj112/myfolder/
/srv/www/prj112/myfolder/ is owned by rsyncuser. My problem is that eventhough with rsync the sub directories are create as they publish, each directory is assigned default permission of d--------- so rsync fails to copy any files inside it.
How do I fix this?
The option to ignore NTFS permissions has changed in Cygwin version 1.7. This might be what's causing the problem.
Try adding the 'noacl' flag to your Cygwin mounts in C:\cygwin\etc\fstab, for example:
none /cygdrive cygdrive user,noacl,posix=0 0 0
You can pass custom permissions via rsync using the 'chmod' option:
rsync -rvz --chmod=ugo=rwX -e ssh source destination
Your problem stems from the fact that the Unix permissions on that directory really are 0. All of the access information is stored in separate ACLs, which rsync does not copy. Thus, it sets the permissions on the remote copy to 0, and, obviously, is unable to write to that directory afterwards.
You can run
chmod -R 775
on that directory, which should fix your rsync problem.
After a look at the manpage I can tell that the chmod param is available in rsync since version ~2.6.8. But you have to use --chmod=ugo=rwX in combination with rsync -av
You should also try this command:
rsync -av <SOURCE_DIR> rsyncuser#192.168.1.110:/srv/www/prj112/myfolder
It would work on Linux at least. And note that rsync does not need to mention ssh--at least on Linux.
But if all fails and just to give an option you may take a look at this ready packed-up tool cwRsync
if you deploy a site from windows (for ex. octopress use rsync) it's possible set permission to 775 adding multiple chmod command:
rsync -avz --chmod=ug=rwx --chmod=o=rx -e ssh
To rsync from Windows to Unix/Linux you should provide a command like
SET BACKUP_SERVER=my.backup.server
SET SSH_USER=theUnixUserName
SET STORAGEPATH=/home/%SSH_USER%/Backup/
SET STORAGEURI=%BACKUP_SERVER%:%STORAGEPATH%
SET SSH_ID=/cygdrive/c/Users/theWindowsUserName/Documents/keyfiles/id_dsa
SET EXCLUDEFILE=backup_excludes.txt
SET BACKUPLOGFILE=/cygdrive/c/Users/theWindowsUserName/Backuplogs/backup-%DATE%-%TIME::=-%.log
The ssh command then is
SET BACKUP=rsync -azvu --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r --rsh="ssh -l %SSH_USER% -i '%SSH_ID%'" --exclude-from=%EXCLUDEFILE% --delete --delete-excluded --log-file="%BACKUPLOGFILE%"
with backup_excludes.txt containing lines of ignored elements like
.git
.svn
.o
\Debug
\Release
Then you would use this in a script with
%BACKUP% /cygdrive/c/mySensibleData %STORAGEURI%
%BACKUP% /cygdrive/c/myOtherSensibleData %STORAGEURI%
%BACKUP% /cygdrive/c/myOtherSensibleData2 %STORAGEURI%
and so on. This will backup your directories mySensibleData, myOtherSensibleData and myOtherSensibleData2 with the permissions 755 for directories and 644 for files. You also get backup logs in your %BACKUPLOGFILE% for each backup.
Cygwin rsync will report permission denied when some process has the target file open. Download and run Process Explorer and find out if anything else is locking the file or simply try renaming the file and see if you get the Windows error about some other process having the file open.
Also, you can try to create a (global) environment variable CYGWIN and set its value to nontsec

Resources