Prometheus_3 Posted October 30, 2015 Posted October 30, 2015 (edited) Hello, After a recent upgrade of ownCloud I ran a script to set the permissions. The script was supposed to be this: #!/bin/bash ocpath='/srv/owncloud' htuser='www-data' htgroup='www-data' rootuser='root' # On QNAP this is admin find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640 find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750 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 ${rootuser}:${htgroup} ${ocpath}/.htaccess chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess chmod 0644 ${ocpath}/.htaccess chmod 0644 ${ocpath}/data/.htaccess I pasted the script directly from their website and I missed a portion of the start. #!/bin/bash -- Whole line was missing ocpath='/var/www/owncloud' -- I missed the o at the start of this line so the variable wasnt properly defined. After this script was executed I immediately lost access to su commands and I recieved "Permission denied" when attempting to change directory. I foolishly rebooted the server and now it wont boot. I get the error run-init : /sbin/init: Permission denied It is currently running in a VM.I have been able to access the installation disc and selected Rescue a Broken System. This is the only access I have to the server to try and repair it. Unfortunately I am at a dead end. Edited October 30, 2015 by Prometheus_3
koryo Posted October 30, 2015 Posted October 30, 2015 Ouch that looks nasty! - Basic question first - I don't suppose that since this is a VM and you were running an upgrade, you took a snapshot you could now revert back to?
Dodgex1 Posted October 30, 2015 Posted October 30, 2015 Whoops, / Change the permissions of all the things! If you run a live CD then mount the file system from your VM can you browse it with the CLi/Nautilus (Think its nautilus on Ubuntu I don't use ubu - the file explorer) on your LiveCD?
mats Posted October 30, 2015 Posted October 30, 2015 If I execute "find ${ocpath}/ -type f -print0" without first defining ocpath, find returns everything. You are then chmod'ing everything to 640 which makes all your commands non-executable. When you then try to use sudo (or chmod or chown), none of these are executable. There are a load of files which need to be made executable for the system to run - this will be a major job. If your /home drive is on a separate partition, it might be better to re-install. Good luck!
mats Posted October 30, 2015 Posted October 30, 2015 Looking at /usr/bin and /bin, pretty much everything is executable. You might get somewhere with using that boot disc and then executing "chmod u+x /usr/bin" and the same for /bin .
NokiX Posted October 30, 2015 Posted October 30, 2015 recover from backup is probably quickest. Yep I would have to agree with that as the amount of time to try and correct all the changes would be huge.
koryo Posted October 30, 2015 Posted October 30, 2015 Alternatively if you don't have a backup, trying a re-install from the install medium over your current installation without formatting -should- over-write the mis-configured system files to re-set their permissions. <- Shot in the dark, haven't ever tried this myself, suggested by a friend of mine who went through a similar process previously. Might be worth a play with. Snapshot first!
CyberNerd Posted October 30, 2015 Posted October 30, 2015 (edited) I'd go for a recovery personally. If this isn't an option I would take it offline and in recovery mode chmod777 so that it boots, then reinstall a similar machine and use rsync/ssh to re-sync the permissions without deleting any files. edit: if you can NFS mount the re-installed version, assuming the UID's and GID's match, you could use chmod --reference to match the files. Edited October 30, 2015 by CyberNerd
Prometheus_3 Posted November 2, 2015 Author Posted November 2, 2015 (edited) Hello, I apologise for not replying sooner. There are no backup options available. I would have performed the backup before the upgrade however I didnt have the storage to take a snapshot of a 2TB server. Unfortunately I am not an expert with Linux so I am uncertain how to chmod 777 the appropriate partition. I have another Ubuntu server I could potentially rsync/ssh the permisisons from, however I do not know to to perform an rsync over SSH. It might be simpler to mount the partition in recovery and copy the config files to another server and reinstall Ubuntu over the exisiting installation. Edited November 2, 2015 by Prometheus_3
CyberNerd Posted November 2, 2015 Posted November 2, 2015 Hello, I apologise for not replying sooner. There are no backup options available. I would have performed the backup before the upgrade however I didnt have the storage to take a snapshot of a 2TB server. Unfortunately I am not an expert with Linux so I am uncertain how to chmod 777 the appropriate partition. I have another Ubuntu server I could potentially rsync/ssh the permisisons from, however I do not know to to perform an rsync over SSH. It might be simpler to mount the partition in recovery and copy the config files to another server and reinstall Ubuntu over the exisiting installation. Although I suggested rsync earlier, I don't think it's possible to rsync just permissions without copying files. I think what you should do: sudo chmod 777 / -R apt-get update && apt-get upgrade 'dpkg --get-selections > listofpackages.txt' (to get a list of installed apps on the broken system) Install the same version of ubuntu onto a NEW machine run "dpkg --set-selections < listofpackages.txt' on the new machine to give it the same package list as the broken one apt-get update && apt-get upgrade mount the now machine from inside the old one. (or vice versa) recursively run chmod --reference (new filesystem) (old filesystem) I think this might work but I'd get someone else to check it first.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now