Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to install colordiff in a custom directory because I do not have sudo privileges. I did make the directories hard-coded in the Makefile as stated in the README, but I'm getting this error:

...
chown root.root /share/edu-mei/colordiff/1.0.13/etc/colordiffrc
chown: changing ownership of `/share/edu-mei/colordiff/1.0.13/etc/colordiffrc': Operation not permitted
make: [install] Error 1 (ignored)
...

Changing this file ownership is not really a problem (probably the reason that the author ignores this). However I'm not familiar with this usage of chown.

The manpage from chown says that the command syntax is:

chown [OPTION]... [OWNER][:[GROUP]] FILE...
chown [OPTION]... --reference=RFILE FILE...

But the command executed is chown root.root $file.

What does the syntax with a dot rather than a colon mean?

share|improve this question
    
Dot instead of colon is also valid. I think that's about it. –  TNW Apr 17 '13 at 12:39
    
The answers below explain the syntax, but this command fails because as non-root, you can't change ownership to root. –  depquid Apr 17 '13 at 15:52
    
@depquid that was easy to figure out with the syntax clarified. After all, my question weren't about the error. –  RSFalcon7 Apr 17 '13 at 16:18
add comment

2 Answers

up vote 6 down vote accepted

It sets the user and group of $file to root (as in chown OWNER.GROUP FILE...). It's the same as calling chown root:root $file, but an older form.

The period was replaced by a colon, giving chown OWNER:GROUP FILE... as documented, because periods could potentially appear in user/group names.

share|improve this answer
    
It should be noted for completeness that the reason a colon is used is that it cannot appear in a user or group name, as described here: unix.stackexchange.com/a/6531/1078 –  camh Apr 17 '13 at 23:07
add comment

"chown user.group file" was the old way to use chown to set both user and group for a file. This notation is now deprecated, and you should use ":" instead, as in "chown user:group file".

"$file" is just shell-variable. Probably you have a script that repeats a command (chown) for a list of filenames. The variable "$file" will contain the filename currently being processed, and will change for each "round" the script iterates, until the list (all the filenames) has been processed (have gotten their owner and group set to root:root).

share|improve this answer
    
$file is my own way to express the filename –  RSFalcon7 Apr 17 '13 at 13:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.