PDA

View Full Version : [ubuntu] Do I have to use chown?



kapi
October 11th, 2012, 12:04 AM
I just used the command line to cp some font files to the font folder usr/shar/fonts.

But I read somewhere that I should also use chown. I'm really rusty on bash scripting and haven't really done any since college. The following input worked fine.


~/web development/fonts$ sudo cp fontface2 -R /usr/share/fonts

twipley
October 11th, 2012, 12:06 AM
I just used the command line to cp some font files to the font folder usr/shar/fonts.

But I read somewhere that I should also use chown. I'm really rusty on bash scripting and haven't really done any since college. The following input worked fine.


~/web development/fonts$ sudo cp fontface2 -R /usr/share/fonts


Well, chowning is easy.

sudo chown -R 777 /usr/share/fonts

might be giving it a quick go;

tell us how it went!

kapi
October 11th, 2012, 12:22 AM
Thanks for the reply,

The fonts are visible and working so I don't think I need to use chown as I am the only user on my laptop.

Cheers though

oldos2er
October 11th, 2012, 03:03 AM
I wouldn't use chown on system files (anything outside your home folder) unless you know exactly what you're doing. Linux relies on root permissions on system files for much of its functioning.

Elevating your user privileges with sudo is the proper way to do what you want to do.

bab1
October 11th, 2012, 03:18 AM
Well, chowning is easy.

sudo chown -R 777 /usr/share/fonts

might be giving it a quick go;

tell us how it went!

This won't work as you expected.

The command chown changes ownership and it is used like this on a file (or directory) owned by user1
sudo chown user2 somefile...if you wanted to change the group you would use this variation
sudo chown user2:user2 somefile

The command chmod changes the users permissons (i.e 775) from your 777 like this
sudo chmod 775 somefile

You can view the gory details here
man chown

man chgrp

man chmod

shaktiman1234
October 11th, 2012, 01:47 PM
always be cautious before using chown, chmod, chgrp commands. If applied to a wrong file/directory you can screw up your whole installation.