How to create username with "."

Aleksandar Milivojevic alex at milivojevic.org
Thu Sep 21 15:47:31 UTC 2006


Quoting "Miner, Jonathan W (CSC) (US SSA)" <jonathan.w.miner at baesystems.com>:

> The chown(1) man page says that a colon ":" is the delimiting character:
>
> NAME
>        chown - change file owner and group
>
> SYNOPSIS
>        chown [OPTION]... [OWNER][:[GROUP]] FILE...

Couple of lines down in the same man page is the following sentence:

"If the user name is followed by a colon or dot and a group name (or  
numeric group ID), with no spaces between them, the group ownership of  
the files is changed as well."

Chown in Linux uses dot as alternative separator between user name and  
group name for compatibility with some Unix systems that use dot  
separator.  Dot was choosen as separator since it is not allowed in  
user names.  On Unix systems, it is advisable to limit yourself to  
8-chars usernames (most utilities will work fine with longer  
usernames, but not all of them).  And also to limit yourself what  
characters you are using.

Without looking in the manual page or trying it out on command line,  
could you answer these questions.

1. If you have users foo and foo.bar, and group bar, what will be  
result of "chown foo.bar filename"?

  A. chown will exit with error
  B. chown will change file owner to foo.bar, and leave the group unchanged
  C. chown will change file owner to foo and group to bar
  D. chown will change file owner to foo.bar and group to bar

2. If you have users foo and foo.bar, but there is no group bar, what  
will be the result of "chown foo.bar filename":

  A. chown will complain group bar does not exist
  B. chown will change file owner to foo.bar
  C. chown will change file owner to foo

3. Same as above, but you have only user foo.bar.

Any program that validates user supplied data could (and should)  
reject usernames with dots if supplied in argument list (just like  
useradd does).  This should especially be the case for Web  
applications (CGI scripts, PHP, ...).

-- 
NOTICE: If you are not intended recipient, you are hereby notified
that by reading this message you agreed not to disturb frogs during
mating season.  For more info, visit http://www.8-P.ca/





More information about the redhat-list mailing list