17

i'm new to Ubuntu and was wondering if there is a way to remove the ownership of all files and scripts from root to user even if i have to re-install Ubuntu? i do know about the command 'chown -v username foldername', although it doesn't work on all files.

walttheboss
  • 596
  • 3
  • 17
rgr
  • 1,879
  • 4
  • 14
  • 10

3 Answers3

21

Just go to the directory you want to change:

cd /opt/lampp/htdocs

and change the permission using the chown command:

sudo chown userName -R codeigniter

Where userName is the username and codeigniter is the folder's name.

gavin
  • 105
  • 4
Saad Mirza
  • 457
  • 1
  • 4
  • 7
  • 1
    @spasSpasov: Could you please review my [edits](http://askubuntu.com/posts/874432/revisions) and also review the [editing help](http://askubuntu.com/editing-help) to improve the readability of your own edits in the future... **;-)** – Fabby Jan 21 '17 at 08:41
  • 1
    @Fabby Yes of course, I will. – pa4080 Jan 21 '17 at 08:46
  • Sure.But the Answer will not be helpfull for new users. – Saad Mirza Jan 21 '17 at 11:04
10

When you do an install you have several directories. Everything in /home/user/ can be changed to your user. If you chown the others your system will break. And when you chown you need to make sure you chown to the user and NOT just some name you choose. It will be the same name as the folder under /home/. Do not change either permissions or ownership of anything but files under /home/user/.

sudo chown -v -R user:user /home/user/

The command will change the user and the group to the same at the same time.

walttheboss
  • 596
  • 3
  • 17
4

The below is for individual file:

sudo chown user:user filename

For an entire directory it will be:

sudo chown user:user dirName

For recursive (i.e files and folders inside a folder):

sudo chown -R user:user dirName

Note: user is, if you do pwd under any Documents, you will see the path: /home/jhon/Documents. Here user is jhon.

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
sg28
  • 141
  • 3