On a Windows client side, one could just use SecureCRT as it appears to support this by default, and using it would probably make the Windows side of this much simpler. If both the client and server sides are non-Windows systems, that can also simplify matters.
Because SecureCRT is not free software, many people use PuTTY or one of its forks: "KiTTY" or "Le Putty." One reason for both of these is the addition of support for Zmodem transfers.
Windows Client Side:
The KiTTY program can be found here: http://www.9bis.net/kitty/?page=ZModem
Le Putty home page: http://leputty.sourceforge.net/
In both cases there is no Windows installer, it's just a [zipped] .exe program that includes or requires the "sz.exe" and "rz.exe" executable files as well.
With both KiTTY and Le Putty the Zmodem settings are saved within the particular session profile. With KiTTY the saved sessions/settings seem to be shared with those of PuTTY if it has also been used.* Be sure to save your session info with your chosen Zmodem-transfer settings.
The settings for Zmodem transfers include the local folder for downloads to arrive in as well as the path and command line options for the client-side sz and rz commands, which should include the full path as well as the .exe extension.
For example, you might place your rz.exe and sz.exe files in a folder like C:\sshz, along with the KiTTY or Le PuTTY program files. In the settings you might set your Zmodem download folder to "C:\sshz\downloads" and the command lines for sz to "C:\sshz\sz.exe" and for rz to "C:\sshz\rz.exe" respectively.
(note: it would probably be wiser to use a different directory than just C:\sshz, maybe something in your user profile or My Documents folder. This is just an example path.)
That's about it for the Windows client side of things, though I would also note that in order to actually start a Zmodem upload from the client after the "rz" command has been used on the server, you must right-click on the terminal window's title-bar with your mouse pointer and then choose "Zmodem Upload" and select the file to be sent. Likewise, to download a file after starting "sz" you'd need to right-click the title bar and select Zmodem Receive.
Remote host server side:
If the server already has the rz and sz (or lrz and lsz) commands installed and available, your work is done for you there. If not, you can install them yourself from source, even if you don't have root access. Personally I find this quite handy and nice to be able to do: building and installing software even without root access.
At the time of writing, the source tarball is available at: ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz
If you do indeed have root access and wish to install lrz and lsz on the system, there might be a package available for your distribution. With Debian or Mint or Ubuntu, for example, you can just install it using apt-get like so:
apt-get install lrzsz
When installing from source, however, the "-prefix=$HOME" option for the ./configure command line below is necessary if operating without root access. In the following example I do not have root access to my web hosting machine and so I did use that option.
The commands I used to install lrzsz are as follows:
cd ~
mkdir gets
cd gets
wget http://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz
tar -xzvf lrzsz-0.12.20.tar.gz
cd lrzsz-0.12.20
./configure -prefix=$HOME
make
make install
find . | grep lsz
(and of course what the commands are doing is: first navigating to the user's home directory, then
creating a folder called "gets" for keeping files downloaded with wget, then entering that folder, then using wget to download the source tarball to the folder, then un-zipping the contents with tar, then entering the new folder for lrzsz, then building and installing it with configure/make/make install, then locating the binary executable file with find.)
After that I used "alias" so that when I type the commands "sz" or "rz" it will use the lsz/lrz programs, like so :
alias sz='~/gets/lrzsz-0.12.20/src/lsz '
alias rz='~/gets/lrzsz-0.12.20/src/lrz '
Those lines could be added to your .bash_profile or .bash_rc file, for example, to insure that they're aliased every time you log in.
Note that in this scenario, using "sz" on the remote host requires that you specify in the command line the file to be sent, like "sz filename" for example, whereas using "rz" doesn't require a file name to be specified. "rz" may require the "-y" option to overwrite a file if there is already a file with the same name in the working directory. After a transfer there may be a bit of confusing text in the console which can be clarified by pressing ENTER a couple of times to see the prompt again, or by using the "clear" command. Using "Ctrl-C" does not abort the command after using sz or rz but it will timeout within a few minutes if the transfer is not started.
[Edit] Please Note that the permissions for transferred files may not be as expected.
I find myself using "chmod 644 filename" often after uploading files.
This point could be an important security consideration.
There are a number of command line options for both "rz" and "sz" which can change their behavior, and they can be listed by using "rz --help" or "sz --help" respectively, even if the "man pages" or the "info" command do not provide documentation.
Note that in this scenario, using "sz" on the remote host requires that you specify in the command line the file to be sent, like "sz filename" for example, whereas using "rz" doesn't require a file name to be specified. "rz" may require the "-y" option to overwrite a file if there is already a file with the same name in the working directory. After a transfer there may be a bit of confusing text in the console which can be clarified by pressing ENTER a couple of times to see the prompt again, or by using the "clear" command. Using "Ctrl-C" does not abort the command after using sz or rz but it will timeout within a few minutes if the transfer is not started.
[Edit] Please Note that the permissions for transferred files may not be as expected.
I find myself using "chmod 644 filename" often after uploading files.
This point could be an important security consideration.
There are a number of command line options for both "rz" and "sz" which can change their behavior, and they can be listed by using "rz --help" or "sz --help" respectively, even if the "man pages" or the "info" command do not provide documentation.
*(Unless it's the portable KiTTY package available from portableapps, which seems to keep its own data separate and isolated from that of PuTTY.)
Links and references:
SecureCRT info: https://www.vandyke.com/products/securecrt/ssh_file_transfer.html
Kitty Zmodem-specifics: http://www.9bis.net/kitty/?page=ZModem&theme=none
Le Putty: http://leputty.sourceforge.net/
lrzsz: https://ohse.de/uwe/software/lrzsz.html
helpful page: https://waltonr.wordpress.com/2011/12/08/howto-lz-rz-function-sexy-commandline-file-transfers/
helpful page: http://sourceforge.net/p/leputty/support-requests/1/
No comments:
Post a Comment