1. Download our Official Android App: Forums for Android!

Support Permission denied copying file?

Discussion in 'Android Devices' started by Claghorn, Jul 28, 2013.

  1. Claghorn

    Claghorn Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    340
    Joined:
    Feb 3, 2012

    Is there some new mysterious security BS in android 4.3?

    I've been setting up my new 2013 Nexus 7, and I'm trying to get rsync to work to backup the files Titanium Backup stashed on the sdcard, but it says "permission denied" when I try to copy them. I can't find any problems with any permissions:

    Here I am in /storage/emulated/legacy/TitaniumBackup

    and an ls -l looks like:

    -rw-rw-r-- root sdcard_rw 8271 2013-07-28 19:48 xcxin.filexpert-20130728-234815.properties
    -rw-rw-r-- root sdcard_rw 4029 2013-07-28 19:48 xcxin.filexpert-20130728-234815.tar.gz
    -rw-rw-r-- root sdcard_rw 8308712 2013-07-28 19:48 xcxin.filexpert-9349ab6bc87f0af18def492f0576caba.apk.gz

    It saves the .properties file OK, but can't save the .tar.gz file which has the exact same permissions.

    Anyone know what is going on?

    Am I going to have to make the rsync binary setuid root?
     

    Advertisement

  2. wrecklass

    wrecklass Well-Known Member
    Rank:
    None
    Points:
    43
    Posts:
    124
    Joined:
    Jun 9, 2010

    Jun 9, 2010
    124
    29
    43
    Where are you trying to copy the files to? Do you have permission to write there?
     
  3. Claghorn

    Claghorn Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    340
    Joined:
    Feb 3, 2012

    When I tried copying manually, I did indeed pick a directory where I could write, but rsync is just trying to read them and write them across the network, and it can read the .properties files, but gets permission denied on the .tar.gz files, so there is something magic about the .tar.gz files that doesn't show up in ls -l.
     
  4. John Bean

    John Bean Happy Wanderer
    Rank:
    None
    Points:
    163
    Posts:
    1,251
    Joined:
    Jul 28, 2010

    Jul 28, 2010
    1,251
    458
    163
    Male
    Waterfoot, Lancashire
    Just to be clear - do you get the same failure copying the file manually with cp (whatever) or is it just rsync that's reporting the error?

    I'm getting a bit concerned about all these "minor" glitches with 4.3. I also use rsync to backup both my Nexus 7 and 4 to a NAS and (as yet) haven't updated them from 4.2; until we get to the bottom of this (and a lot of other glitches) I don't think I'll be in a rush to do so :-(
     
  5. Claghorn

    Claghorn Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    340
    Joined:
    Feb 3, 2012

    Everything that tries to copy one of the .tar.gz files gets permission denied, both rsync and cp (when I'm not running as root, anyway).

    Everything that tries to copy one of the .properties files can copy it with no errors (also not running as root).

    Yet "ls -l" says the files all have the same permissions.
     
  6. John Bean

    John Bean Happy Wanderer
    Rank:
    None
    Points:
    163
    Posts:
    1,251
    Joined:
    Jul 28, 2010

    Jul 28, 2010
    1,251
    458
    163
    Male
    Waterfoot, Lancashire
    Bizarre. I've never had any issues with confused permissions on any *nix-based system including Android - until now. I do hope Google aren't fscking around with the underlying system to the point of sacrificing consistency and reliability on the altar of "security".

    They can and do make the top-level Java-based more and more secure (but restrictive) with every build, but I'm not sure it's such a good idea to be too heavy handed with the already pretty solid Linux it sits on.
     
  7. wrecklass

    wrecklass Well-Known Member
    Rank:
    None
    Points:
    43
    Posts:
    124
    Joined:
    Jun 9, 2010

    Jun 9, 2010
    124
    29
    43
    Ok, and what happens if you do 'tar tzvf xcxin.filexpert-20130728-234815.tar.gz', do you get a file listing from the tarball?

    I'm just trying to figure out if the permissions is on writing the file or reading it.

    Also, what happens if you do something like 'touch /the/destination/directory/test.txt'

    Just to see that you have write permissions there as you believe you do.
     
  8. Claghorn

    Claghorn Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    340
    Joined:
    Feb 3, 2012

    There just ain't any read permission at all (even when I'm root, apparently). I did get mail from the titanium track folks saying they are aware of the problem and working on a fix, but I still don't know what the actual issue is. I guess there is some new ACL mechanism (or new use of existing mechanism) in android 4.3.

    Actually in the latest titanium backup update, I can read the tar.gz files now, but I still can't read the apk.gz files.
     
  9. John Bean

    John Bean Happy Wanderer
    Rank:
    None
    Points:
    163
    Posts:
    1,251
    Joined:
    Jul 28, 2010

    Jul 28, 2010
    1,251
    458
    163
    Male
    Waterfoot, Lancashire
    Ah, so it's something TB is doing when it writes the compressed file? This is even stranger, because I let my Nexus 4 update (wish I hadn't though!) and half expected a similar problem, but no.

    Instead I found other broken things including the script manager I normally use to run things like rsync to save typing; I've used it since 1.5 on a variety of devices and it's never given a hint of trouble - until 4.3.

    However when I ran the script manually it worked fine, no problem at all with the newly created TB backups, of which there were quite a few. The exact command line I use to backup the Nexus 4 to one of my NAS devices is "rsync -rtOvz --size-only /sdcard/ 192.168.1.21::backup/Nexus4/" but I doubt it makes any difference for the purpose of this discussion. The one on the Nexus 7 is identical apart from the destination directory.
     
  10. Claghorn

    Claghorn Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    43
    Posts:
    340
    Joined:
    Feb 3, 2012

    It isn't the only weird error I've seen. I tried to rsync some files from my computer to my Nexus, and rsync complains that it can't set the time on the file after it copies it (it did at least complete the copy, but couldn't reset the time to the original time from the host machine).

    I'm sure there must be something "new and improved" going on in 4.3, I just wish I could find a hint about what it was :). I'll be interested to see if my old Nexus 7 starts getting the same problems when I finally get the 4.3 update.
     
  11. John Bean

    John Bean Happy Wanderer
    Rank:
    None
    Points:
    163
    Posts:
    1,251
    Joined:
    Jul 28, 2010

    Jul 28, 2010
    1,251
    458
    163
    Male
    Waterfoot, Lancashire
    I've had various time synchronisation issues when using rsync on Android even back in the 2.1 days; I never did get to the erm... root... of the problem.

    My quick and dirty work-around is the "--size-only" option to prevent the same unchanged files from being copied over and over again because of failures to match timestamps.

    I never have the problem with real Linux systems, only Android.
     

Share This Page

Loading...