Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

define allowed format of usernames - login.defs does not wrk

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
DawgG
l33t
l33t
User avatar
Posts: 880
Joined: Wed Sep 17, 2003 12:31 pm

define allowed format of usernames - login.defs does not wrk

  • Quote

Post by DawgG » Wed Apr 20, 2016 1:20 pm

on my systems i need usernames in the format
NN.NNN.NNN-N
(N=0-9)
useradd won't accept usernames in this format and /etc/login.defs has no setting for the allowed format/chars. Adding the entry CHARACTER_CLASS produces a configuration error (i tried shadow with and without USE="pam")
How to change the allowed format of the usernames?
THX for your help!
DUMM KLICKT GUT.
Top
Syl20
l33t
l33t
User avatar
Posts: 621
Joined: Thu Aug 04, 2005 4:00 pm
Location: France

  • Quote

Post by Syl20 » Wed Apr 20, 2016 1:33 pm

You can't set a username beginning with a number. And, even if you could, it's a really bad idea, as some shell commands are able to play with usernames and UIDs/GIDs indifferently.
You can't set a username containing a dot (period) character. And, even if you could, it's a really bad idea, as some shell commands are able to use it as a separator.
Top
DawgG
l33t
l33t
User avatar
Posts: 880
Joined: Wed Sep 17, 2003 12:31 pm

  • Quote

Post by DawgG » Wed Apr 20, 2016 1:47 pm

You can't set a username beginning with a number. And, even if you could,
yes, you can, just not with useradd.
You can't set a username containing a dot (period) character.
try

Code: Select all

useradd user.33
it's a really bad idea, as some shell commands are able to use it as a separator.
i know that but it was not my question.
DUMM KLICKT GUT.
Top
guitou
Guru
Guru
Posts: 534
Joined: Thu Oct 02, 2003 1:00 pm
Location: France

  • Quote

Post by guitou » Wed Apr 20, 2016 3:22 pm

Can't you simply try and change your requested username format to something more suitable, like prefixing with USER, or even U, and replacing dots with underscores? Would be simple using regular expressions.
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

  • Quote

Post by khayyam » Wed Apr 20, 2016 3:54 pm

DawG ...

forget about login.defs, shadow defines the following match:

Code: Select all

* User/group names must match [a-z_][a-z0-9_-]*[$]
... but it's not shadow but pam that is handling what happens when useradd is run, I'd suspect pam_unix or pam_permit. So, I would search there, or the pam docs.

best ... khay
Top
Chiitoo
Ninja Apprentice
Ninja Apprentice
User avatar
Posts: 3079
Joined: Sun Feb 28, 2010 5:36 pm
Location: Sore wa sore, kore wa kore... nanoda.

  • Quote

Post by Chiitoo » Wed Apr 20, 2016 4:32 pm

Merged the above two posts from [topic=1043300]define allowed format of usernames - login.defs does not wrk[/topic].

There can be only one. ^^
Kindest of regardses.
Top
DawgG
l33t
l33t
User avatar
Posts: 880
Joined: Wed Sep 17, 2003 12:31 pm

changed function in shadow - can be done now

  • Quote

Post by DawgG » Fri Apr 22, 2016 9:46 am

THX to all for your help!

i bluntly changed the function in libmisc/chkname.c (in shadow) to return true (instread of false) in the case of such a username, emerged it via PORTDIR_OVERLAY and now this can be done.
(of course it's not good, smart, etc, but still thank you!)
DUMM KLICKT GUT.
Top
Post Reply

7 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic