LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   useradd: invalid username username$ (https://www.linuxquestions.org/questions/fedora-35/useradd-invalid-username-username%24-255871/)

engyeow 11-17-2004 01:35 AM

useradd: invalid username username$
 
Hi guys,

After installed FC3, i have problem joining windows client to samba PDC
I use samba-3.0.8

Issue:
#useradd -M machine_name$
useradd: invalid user name 'machine_name$'

I remember i don't face this problem with RH9. I can add my windows machine hostname with a $ behind, when joining samba domian server.

/etc/samba/smb.conf
add machine script = /usr/sbin/useradd -s /bin/false -d /dev/null -M %u

Does anyone know what's going on?

Thanks and regards,
Eng Yeow

druuna 11-17-2004 03:08 AM

You are not allowed to use anything but the following for loginnames:

alphanumeric characters, the period (.), underscore (_), plus (+), and minus (-) characters)

I know that some distro's do allow other characters to be used, but this is not officially allowed.

Hope this helps.

kozgun 11-17-2004 04:44 AM

Quote:

I know that some distro's do allow other characters to be used, but this is not officially allowed.
Slackware allows this type of naming, and also FC1 allows this. I've been thinking of
creating lots of users using "_". What do you mean this is not officially allowed? Is this
related with bash or useradd script or FC?

Thank you.
-ozgun.

druuna 11-17-2004 05:23 AM

The _ is allowed (as I stated in the previous post).

Characters like $ % & # ! (etc) should not, and most often can not, be used for usernames.

The loginname is very often used by other programs (mail being one), which restricts the use of special characters.

What about the following.

Your loginname is: foo@bar
The emailaddress created will be: foo@bar@some.machine

I don't think mailers will like this.......

Another example is :, which is used as a seperator in /etc/passwd. A username like john:doe is therefore not usable.

engyeow 11-17-2004 08:49 AM

Thanks guy for replying.

I just found out it could be due to different version of the package shadow-utils (provides useradd function, etc) that being used in RH9 and FC3.

I don't intend to create username with a $ behind. This is automatically done when joining windows 2000 pro machine to samba PDC server. I'm trying to use Samba to replace my existing Windows 2000 server.

The following line in /etc/samba/smb.conf did the adding of machine trust account:
add machine script = /usr/sbin/useradd -s /bin/false -d /dev/null -M %u
So, windows will just append $ behind the hostname automatically.

There is a solution which need to manually create all my windows client Pc's hostname before joining them to samba domain, this could be troublesome.

I think I may use RH9 instead of FC3, unless someone got better solution.

Thanks,
Eng Yeow

bvdbos 12-05-2004 04:35 AM

temporary solution
 
In my first days as a linux-user I've stumbled accross the same problem and found the following soultion, assuming teh group machines:

# useradd -g machines -d /dev/null -s /bin/false winmachine
# passwd -l winmachine

Notice the lack of the string. Now here comes the tricky part. Make backup copy's of the files "/etc/passwd" and "/etc/shadow" first. Manually edit the "/etc/passwd" and "/etc/shadow" and change the machine name to include a string. In my case my winxp-machine was called hemel3, so I changed the name in both files to hemel3$.

Then add the user to samba:
# smbpasswd -a -m machine_name

This should work for now. Also, as of nov 16th there's a new version of shadow-utils which handels this, didn't try it yet though.
http://fr.rpmfind.net/linux/RPM/fedo...3-42.i386.html

gr

Bas


All times are GMT -5. The time now is 09:38 PM.