showkey
showkey

Reputation: 358

what does the second www-data mean?

I know little about chown.

chown rob:developers strace.log

Change the owner of strace.log to 'rob' and the group identifier to 'developers'.

how about the command :

chown  www-data.www-data /var/www/html/

1.it is www-data.www-data ,not www-data:www-data ,what does . mean here?
2.I know the first www-data is the group name, how about the second www-data mean here?

In my system :debian7.

cat   /etc/group
www-data:x:33:

cat  /etc/passwd
www-data:x:33:33:www-data:/var/www:/bin/sh

The command chown -Rf www-data.www-data /var/www/html/ works fine in my debian.

Upvotes: 3

Views: 740

Answers (3)

Abhay PS
Abhay PS

Reputation: 4175

In older version of chown '.' and ':' were used to seperate username and group. But nowadays some versions of chown are still allowing '.' for backward compatibility. Now ':' is the preferred way.

The chown command works like this -

chown [-fhv] [-R [-H | -L | -P]] owner[:group] file

chown [-fhv] [-R [-H | -L | -P]] :group file

In chown you must specify owner, but the group is optional. And group can be specified with ':' after owner.

So technically, chown www-data.www-data /var/www/html/ should fail with more recent versions of chown.

Upvotes: 0

sandipon
sandipon

Reputation: 986

chmown owner_name.group_name file/directory

chown(1) - Linux man page

How To Use chmod and chown Command

Full list of chown command:

chown owner-user file
chown owner-user:owner-group file
chown owner-user:owner-group directory
chown options owner-user:owner-group file

Upvotes: 1

SMA
SMA

Reputation: 37023

It has similar meaning just that dot(.) was an older way of separating owner and group as per this

Previous versions of the chown utility used the dot (``.'') character to distinguish the group name.

This has been changed to be a colon (``:'') character, so that user and group names may contain the dot character.

Upvotes: 2

Related Questions