0

I am completely new to a Linux operating system and was trying to setup Owncloud to use as a file server. I need to copy the owncloud folder into /var/www/ as an example but every folder on my system I am denied access to other than folders within my home folder. I am logged in as administrator but it tells me I am not the owner and do not have permission to access or make changes to any of the other folders. Any help with this would be greatly appreciated.

1

3 Answers 3

-1

You need to take ownership of the directories you want to access.

Open terminal

sudo -s hit enter and authenticate

chown -hR root /u

(change root to the username you want to take ownership) (u is the file path)

Here is an example:

chown -hR username /home/username/.config/ibus

The syntax -hR takes ownership of subfiles and folders too!

Remember command line in linux IS case sensitive.

Why did I lose 2 points for answering this question correctly? It is 100% correct on the money, you just need to take care with which directories you take ownership of as it can cause security issues!

5
  • You are correct that changing ownership would allow access. However, Changing who owns the files/directories can break other processes that might need access. A better solution would be to See which group has access and add the current user to that group.
    – jmunsch
    Nov 16, 2014 at 21:53
  • Why did I get down voted for giving a 100% correct answer? Nov 17, 2014 at 0:57
  • 1
    From my previous comment: "Changing who owns the files/directories can break other processes that might need access." ... doing a recursive chown is ONLY partially correct. Which makes it 100% wrong.... MySQL for example?
    – jmunsch
    Nov 17, 2014 at 17:04
  • I like what you're trying to say, but you're just not warning people enough that what you're doing might be dangerous. Nov 17, 2014 at 23:46
  • My original answer did warn people, someone edited it out... :( Nov 18, 2014 at 0:24
-2

To install Owncloud on ubuntu properly please follow instruction here: http://www.howtoforge.com/how-to-install-owncloud-7-on-ubuntu-14.04

Also you can access files that are normally denied by running the file manager as root and you can access any folder you like.****Take caution when using this file manager****

Press Alt+F2 

then type in

gksudo nautilus

It will ask for your password then you are free to use everything in your computer.

Or do it via terminal first Open terminal

ALT + CTRL + T

copy and paste this code gksudo nautilus

3
  • 1) gksudo is no longer a default. 2) if you don't understand the ramifications of operating as root, you definitely shouldn't be doing it. Nov 17, 2014 at 23:48
  • Can you please ellaborate or guide me in the right direction to why gksudo is not a defualt way ?, or why it should not be used ? . I dont wanna guide people in the wrong direction or myself, but doing this has saved me lots of headaches in the past. Nov 18, 2014 at 3:23
  • gksudo has been removed from the default install and may be removed at some point altogether... so you shouldn't recommend something that is on the chopping block. Nov 18, 2014 at 5:41
-3

Best way to do it is to copy needed files as root

sudo cp -r ORIGIN DESTINATION

You also can change folder owner to yourself with

chown USER.GROUP DIRECTORY

or give write access to it to everyone with

chmod 777 DIRECTORY

These are more dangerous, be careful when doing this and use only with no outer access to the directory.

If you feel yourself better when working with GUI, you can try launching your file manager as root,

sudo nautilus

for example. Again - be very careful. This behaviour was intended to help reduce human errors.

4
  • cp -r to change permissions would not be the best way to do it. Neither would chmod 777. Also you can use backticks to quote code, and create code blocks by writing code and then highlighting it and pressing ctrl+k
    – jmunsch
    Nov 14, 2014 at 15:59
  • @jmunsch the big question was "I need to copy the owncloud folder into /var/www/ as an example but every folder on my system I am denied access", so what's wrong with using sudo cp -r for that? And I specifically mentioned that chown and chmod are dangerous. Nov 15, 2014 at 16:25
  • It would be better to see which group has access to the directory with ls -ld directoryname and then give the current user permissions by adding them to that group. I guess if the folder is owned by root you would be correct. And using the 777 flag is generally frowned upon. Setting the permissions to what only is needed is generally more secure, something like 655 or something similar. Using chmod 655 -R dirname by using sudo cp -r the files and folders inherit the same permissions as the parent directory and it doesn't really resolve the user permissions.
    – jmunsch
    Nov 16, 2014 at 21:18
  • 2
    NEVER do chmod 777. This case of this user is /var/www, or some directory outside of their /home/ such as another user's home or a system folder. Running chmod 777 on ANY of those directories or those files is dangerous and opens you to security risks.
    – Thomas Ward
    Nov 17, 2014 at 22:54

Not the answer you're looking for? Browse other questions tagged .