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