22 мар 2012
csp_helper
20120322
NAME
csp_helper — A collection of caspar helper scripts
SYNOPSIS
csp_install file (file) dir (directory)
csp_scp_keep_mode file (file) h ([user@]host) dir (directory)
csp_sucp
file (file)
h ([user@]host)
dir (directory)
[s (su-user)]
DESCRIPTION
The scripts csp_install, csp_scp_keep_mode and csp_sucp are helpers for
caspar(7). These scripts typically are not invoked directly,
but via a Makefile which uses caspar. See the notes on csp_PUSH in
caspar(7) for information on how to link csp_install,
csp_scp_keep_mode and csp_sucp to caspar.
install DESCRIPTION
csp_install creates the required directory (if needed) and installs the file,
preserving timestamps. It uses install(1).
install EXAMPLES
csp_INSTALL_OPTIONS='--owner=www-data --group=www-data' \
csp_INSTALL_MODE=ugo=r \
csp_install index.html /srv/www
csp_INSTALL_MODE=u=rwx,go= csp_install mkpasswd /usr/local/sbin
install ENVIRONMENT
csp_install honors csp_INSTALL_OPTIONS and csp_INSTALL_MODE (default is
u=rw,go=r).
scp_keep_mode DESCRIPTION
csp_scp_keep_mode uses ssh to copy a file to a remote host, keeping its file
permission mode. The trick used is a combination of mktemp(1) and mv(1).
Useful if you'd like to be sure a file gets installed e.g. group writable,
without fiddling with permission bits on the remote host.
scp_keep_mode EXAMPLE
chmod g+w rc
csp_scp_keep_mode rc root@gandalf /etc/uruk
scp_keep_mode ENVIRONMENT
csp_scp_keep_mode honors csp_SSH ("ssh" by default).
sucp DESCRIPTION
csp_sucp calls cat(1) from within sudo(1) from within ssh(1). This allows one
to copy files to accounts on hosts one can only reach by calling sudo on the
ssh-reachable remote host.
Typically, one wants to install a root-owned file, but one does not want to
allow access to the root-account directly from ssh. Typically sudo is used as
an extra line of defense.
sucp EXAMPLES
Some examples:
csp_sucp fstab rms@bilbo /etc
csp_sucp trailer.txt monty-python commit/ list
sucp BUGS
If NOPASSWD is not set in the sudoers(5) file, and one's timestamp is expired,
csp_sucp will forward the sudo password prompt. The given password will
be echoed on the console!
AUTHOR
Joost van Baal-Ilić
SEE ALSO
caspar(7)
The caspar homepage is at http://mdcc.cx/caspar/ .