Tuesday March 11, 2008 After messing around with zones for a few minutes it became clear that it would be really useful if there was a zcp command that worked just like scp(1) but used zlogin as the transport rather than using ssh. For those cases when you are root and don't want to mess with ssh authorizations since you know you can zlogin without a password anyway.
Specifically I wanted to be able to do:
# zcp /etc/resolv.conf bookable-129-156-208-37.uk:/etc
Well it turns out that this is really easy to do. The trick is to let scp(1) do the heavy lifting for you and use zlogin(1) act as your transport. So I knocked together this script. You need to install it on your path called “zcp” and then make a hard link in the same directory called “zsh”. For example:
# /usr/sfw/bin/wget --quiet http://blogs.sun.com/chrisg/resource/zcp.sh # cp zcp.sh /usr/local/bin/zcp # ln /usr/local/bin/zcp /usr/local/bin/zsh # chmod 755 /usr/local/bin/zsh
Now the glorious simplicity of zcp, I'll even trhow in recursvice copy for free:
# zcp -r /etc/inet bookable-129-156-208-37.uk:/tmp ipqosconf.1.sample 100% |*****************************| 2503 00:00 config.sample 100% |*****************************| 3204 00:00 wanboot.conf.sample 100% |*****************************| 3312 00:00 hosts 100% |*****************************| 286 00:00 ipnodes 100% |*****************************| 286 00:00 netmasks 100% |*****************************| 384 00:00 networks 100% |*****************************| 372 00:00 inetd.conf 100% |*****************************| 1519 00:00 sock2path 100% |*****************************| 566 00:00 protocols 100% |*****************************| 1901 00:00 services 100% |*****************************| 4201 00:00 mipagent.conf-sample 100% |*****************************| 6274 00:00 mipagent.conf.fa-sam 100% |*****************************| 6232 00:00 mipagent.conf.ha-sam 100% |*****************************| 5378 00:00 ntp.client 100% |*****************************| 291 00:02 ntp.server 100% |*****************************| 2809 00:00 slp.conf.example 100% |*****************************| 5750 00:00 ntp.conf 100% |*****************************| 155 00:00 ntp.keys 100% |*****************************| 253 00:00 inetd.conf.orig 100% |*****************************| 6961 00:00 ntp.drift 100% |*****************************| 6 00:00 ipsecalgs 100% |*****************************| 920 00:00 ike.preshared 100% |*****************************| 308 00:00 ipseckeys.sample 100% |*****************************| 510 00:00 datemsk.ndpd 100% |*****************************| 22 00:00 ipsecinit.sample 100% |*****************************| 2380 00:00 ipaddrsel.conf 100% |*****************************| 545 00:00 inetd.conf.preupgrad 100% |*****************************| 6563 00:00 hosts.premerge 100% |*****************************| 112 00:00 ipnodes.premerge 100% |*****************************| 61 00:00 hosts.postmerge 100% |*****************************| 286 00:00 ipqosconf.2.sample 100% |*****************************| 3115 00:00 ipqosconf.3.sample 100% |*****************************| 1097 00:00 #
I'll file and RFE for this to go into Solaris and update this entry when I have the number.
Update: The Bug ID is 6673792. The script now also supports zsync and zdist although niether of those have been tested yet.
Except where otherwise noted, this site is
licensed under a Creative Commons License 2.0
This is a personal weblog, I do not speak for my employer.
/usr/bin/zsh already exists and is a SHELL (and the one I've been using for about 15 years now!). Me thinks you need a better name :-) Other than that, very nice and oh so simple.
Posted by Darren Moffat on March 12, 2008 at 02:30 PM GMT #
Good point Darren. Although ksh is the one true shell;-).
I've updated the script so that "zsh" can be installed as "zoneshell".
So you need to have the link:
ln /usr/local/bin/zcp /usr/local/bin/zoneshell
Posted by Chris Gerhard on March 12, 2008 at 02:47 PM GMT #