better method of running without root privileges
This commit is contained in:
parent
00943674af
commit
762f48102f
13
sshbackup
13
sshbackup
|
@ -23,6 +23,7 @@ sshkey=0
|
||||||
bandwidth=0
|
bandwidth=0
|
||||||
limit=0
|
limit=0
|
||||||
list=0
|
list=0
|
||||||
|
noroot=0
|
||||||
options=$*
|
options=$*
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +51,8 @@ usage()
|
||||||
echo " -s, --sshkey <file> alternate sshkey [~/.ssh/id_rsa]"
|
echo " -s, --sshkey <file> alternate sshkey [~/.ssh/id_rsa]"
|
||||||
echo " -b, --bandwidth <kbps> bandwidth limit in kbit/s"
|
echo " -b, --bandwidth <kbps> bandwidth limit in kbit/s"
|
||||||
echo
|
echo
|
||||||
|
echo " -n, --no-root run without root privileges"
|
||||||
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
version()
|
version()
|
||||||
|
@ -78,10 +81,9 @@ amiroot()
|
||||||
preflight()
|
preflight()
|
||||||
{
|
{
|
||||||
#amiroot?
|
#amiroot?
|
||||||
if ( ! amiroot ); then
|
if ( ! amiroot ) && [ $noroot -eq 0 ]; then
|
||||||
echo "warning: in order to conserve owner and group attributes"
|
echo "aborting mission. you need be root or use the --no-root option."
|
||||||
echo "warning: you need to run sshbackup as root."
|
return 1
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#source and destination path?
|
#source and destination path?
|
||||||
|
@ -218,6 +220,9 @@ for option in $options; do
|
||||||
-b|--bandwidth)
|
-b|--bandwidth)
|
||||||
bandwidth=1
|
bandwidth=1
|
||||||
;;
|
;;
|
||||||
|
-n|--no-root)
|
||||||
|
noroot=1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ $config -eq 1 ]; then
|
if [ $config -eq 1 ]; then
|
||||||
if [ -r "$option" ]; then
|
if [ -r "$option" ]; then
|
||||||
|
|
Reference in New Issue