1

Today I was trying to setup Owncloud in my Raspberry Pi, then I stuck when there is need to giving ownership or adding Owncloud file to www-data user and group. After trying all possible options I just opened the owncloud webpage to see what kind of error it generate, and I found the same ownership error and a suggested doc page where a suggested script is given, I executed it and after executing that script EVEN WHEN I AM ROOT I CAN ONLY USE cd COMMAND. If i execute other commands like ls it says access denied even when i am root.

Things I have.

  1. Raspberry pi B+
  2. 32GB Pendrive (FAT23 System) (Treated as cloud storage)

I already have configured apache web server.

  1. I created alias of /cloud to point to /mnt/cloud/owncloud

Due to insufficient memory I placed all owncloud files in mounted directory /mnt/cloud/owncloud.

To change ownership of owncloud I tried

  1. sudo chown -R www-data:www-data /mnt/cloud/owncloud Result : Operation cant be performed (I don't know why) (till this point I am unable to open owncloud index page
  2. sudo chmod 777 /mnt/cloud/owncloud Result : Operation performed (after this command I am able to open http://192.168.192.99/cloud page. But problem is not still solved)
  3. I found a suggestion on index page to open a owncloud documentation and try to resolve the ownership issue. Script is given below

    #!/bin/bash
    ocpath='/mnt/cloud/owncloud'
    htuser='www-data'
    htgroup='www-data'
    rootuser='root'
    
    printf "Creating possible missing Directories\n"
    mkdir -p $ocpath/data
    mkdir -p $ocpath/assets
    
    printf "chmod Files and Directories\n"
    find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
    find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
    
    printf "chown Directories\n"
    chown -R ${rootuser}:${htgroup} ${ocpath}/
    chown -R ${htuser}:${htgroup} ${ocpath}/apps/
    chown -R ${htuser}:${htgroup} ${ocpath}/config/
    chown -R ${htuser}:${htgroup} ${ocpath}/data/
    chown -R ${htuser}:${htgroup} ${ocpath}/themes/
    chown -R ${htuser}:${htgroup} ${ocpath}/assets/
    
    chmod +x ${ocpath}/occ
    
    printf "chmod/chown .htaccess\n"
    if [ -f ${ocpath}/.htaccess ]
     then
      chmod 0644 ${ocpath}/.htaccess
      chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
    fi
    if [ -f ${ocpath}/data/.htaccess ]
     then
      chmod 0644 ${ocpath}/data/.htaccess
      chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess
    fi
    

Link for above code is Here

After executing this script All things are changed I am not able to use any other command then cd and I think to restart Raspberry Pi but it ends up in the state as shown in image Error While boot process is started

I don't know how to

  1. Access the terminal now.
  2. If terminal is accessible how to execute all command when i am Root
1
  • As implied by the duplicate more damage was done than I can see in that script, but the evidence for such is on your screen.
    – goldilocks
    Feb 1 '16 at 13:29

Browse other questions tagged or ask your own question.