RE: How to create username with "."

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting "Miner, Jonathan W (CSC) (US SSA)" <jonathan.w.miner@xxxxxxxxxxxxxx>:

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/


--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux