Giter Site home page Giter Site logo

Comments (5)

cytopia avatar cytopia commented on May 25, 2024

Now the backup seems to complete successfully.

This is because there is no dir check on an existing directory. Try to play around with edge cases, where the directory does not exist, or is a file or a symlink, etc.

Besides, a little bit later down the lines, there is also a test -L check required for incremental backups. I guess this might also be an issue on your side.

The test command currently works well and keeps the source simple. I honestly don't see a way of replacing them. Feel free though to make suggestions and always keep edge cases in mind.

On the other hand, why don't you just allow the test command as well?

from linux-timemachine.

Jip-Hop avatar Jip-Hop commented on May 25, 2024

keeps the source simple

One of the great things about linux-timemachine :)

If I were to allow the test command, users could probe for files outside their restricted directory. Besides, test alongside rrsync would require writing a wrapper script.

The test -L check would be an issue if my destination is accessed via SSH. But I'm only using my SSH server as source (made it read-only with rrsync). So that's not a problem in this case.

I was thinking maybe instead of test something like this:

if [[ $(rsync "${directory}" . --dry-run 2>/dev/null) == "skipping directory"* ]];then echo "It is a directory"; fi

Tested with a file, directory, symlink and nonexistent file.

I know it's ugly, but does not require another command besides rsync and works with rrsync xD

from linux-timemachine.

cytopia avatar cytopia commented on May 25, 2024

If I were to allow the test command, users could probe for files outside their restricted directory.

Isn't that something you could do with a shell anyways?

if [ -f ./some_file ]; then echo "some_file exists"; fi

from linux-timemachine.

cytopia avatar cytopia commented on May 25, 2024

You can also use the sed command (also used in the script) to probe for files: Nvm, sed is only run locally

> sed -i'' 's///' file
sed: -e expression #1, char 0: no previous regular expression

> sed -i'' 's///' fileno
sed: can't read fileno: No such file or directory

from linux-timemachine.

Jip-Hop avatar Jip-Hop commented on May 25, 2024

Isn't that something you could do with a shell anyways?

Yes, but my plan was to block shell access and only allow rrsync over SSH. So users won't be able to run the commands you suggested (which is good) and can't probe or access files outside of their restricted directory.

However then they also won't be able to run the test command and linux-timemachine won't work.

So that's why I suggested to not rely on test, or find a way to replace test with an rsync command (which rrsync would allow).

For the time being I'm chrooting SSH users to their home directory, so they can't use rsync at all...

from linux-timemachine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.