OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: tcoulon on December 15, 2003, 05:53:48 pm

Title: Adding a user
Post by: tcoulon on December 15, 2003, 05:53:48 pm
Hello,

So I decided to use this new X11 ROM, I did it and yes, it\'s real cool. Always dreamed of seing my Z behave like a *real* linux box should and it does now. I think I\'ll send money )

Being a regular Linux user, I however hate to live as root. I tried the \"adduser\" command but it seems it won\'t do anything but answr with it\'s syntax. Anyone\'s got a solution?

Thierry
Title: Adding a user
Post by: enki on December 16, 2003, 01:27:03 pm
i had the same troubles tcoulon... it pretty much means you gotta add the user yourself ...

the way to do it is you\'ll need to edit the /etc/passwd file, /etc/group and /etc/shadow ... i will further in-depth now..

first, /etc/passwd - this file contains basic unshadowed information about the user... the users already there give pretty good examples to work off of, and you can figure out what you want from looking at it:

example:
joe:x:1000:1000:root:/home/joe:/bin/bash

note: everything in these files is delimited by a colon( : ) ...

the first field is the username, the second field, in old unix implementations would contain the \"unshadowed\" (plaintext) passwd, obviously this isn\'t the case anymore, so it just contains an \"x\" as a placeholder. the third and fourth fields are the uid and gid. The uid should be a unique number, 100 is a good one to start with asmost distros will automagically start making new users at 100 then increment from there. The gid us the unique id associated with the user\'s group. It should be 100 for most non-priv\'d users, as this is the gid for users, ill cover this further down the road. the fifth field is the user\'s full name, i beleive (i could be wrong and am too lazy to look at the man  ) ... the sixth field is the user\'s homedir  and the seventh is the user\'s shell of choice , bash is pretty much your only choice for cacko-x11 (ksh anyone?  )

next is /etc/group which holds a list of groups, and what users are \"Attached\" to each group

users:x:100:joe

the first field is the group\'s name , the second is the deprecated passwd field, again, the third is the unique gid for that group ( also the fourth field in the /etc/passwd file) and the last field is a comma-seperated list of users belonging to that group. remember, if the group in question in the user\'s \"main\" group, then the fourth field of that user\'s entry in /etc/passwd should match up with their \"main\" group\'s gid. This is so that a user can be in multiple entries in /etc/group, but still have one primary group that new files made by them will be associated with. If you plan on doing much su or sudo type stuff, to avoid having to log in as root as much, then id recommend also adding the user to the \"wheel\" group.

the last file is /etc/shadow

joe::10933:0:99999:::

ok, this one is a little wierd, but ill break it down like this:

the first field is of course, the user\'s name. The second one should hold either A) nothing (like in this case), means there is NO PASSWORD for that account (ie you just type username, and hit enter twice to log in), this is how root\'s account will after setup.  an asterisk (*) which means there is no passwd, period. i.e. there is no right passwd, so you can\'t log in. or C) if you have actually set a passwd, there\'ll be a bunch of gibberish (an md5 hash i guess). you\'ll prolly want to leave it empty like in case A, then log in and set a passwd, just to play it safe. the third field isthe number of doans btween jan 1, 1970 and the date when the passwd was last changed. This really doesnt matter, all the others say 10933 in cacko\'s /etc/shadow, so i decided to follow suit. the fourth field is the min number of days between passwd changes, this is 0, the fifth is the max number of days. we set to 99999 so that it\'s like 273 years or somethin like that. The next field is the number of days prior to passwd expiration to warn the user, suffice to say you\'ll be pretty old by the time you get that message.  The next three fields are inactive, expire and flag .. and are pretty much alwasy left blank for every day use.

Basically with the information above, you can hand-fabricate your own users, and if you\'d like more information, check out the passwd(4), group(4) and shadow(4) manpages.

update: upon reviewing this post, ive realized how encyclopedic it is in nature .. whoops .. but hey, if you manage to make it all the through then more power to ya!  :roll:
Title: Adding a user
Post by: tcoulon on December 16, 2003, 02:48:08 pm
Thanks, I\'ll try it

Thierry
Title: Adding a user
Post by: Anonymous on December 17, 2003, 05:03:24 am
thanks , it\'s ok!!
Title: Adding a user
Post by: Anonymous on December 25, 2003, 06:45:18 pm
hello enki !

i followed your instructions how to add user \"manually\".


it worked for me as long as i did´t add a passwd via the passwd <username> command.

when i add a user (in /etc/passwd, /etc/group and /etc/shadow)
it works fine when i don´t add a password.

after:

passwd <username>
entering password
re-entering password
logout

i can´t re-login on X with this username and its password.
did i do something wrong ?

perhaps you can help me ?



thanks

ollie
Title: Adding a user
Post by: enki on January 05, 2004, 10:51:55 pm
hmmm ollie... ive never encountered anything like that... the way i usually do it is i first add the user with no passwd, as in the manner i described above... then i log in as the user, and just do \'passwd\' with no follow username ... and im able to change the passwd and log out then back in just fine...

sorry for the late response, i was on vacation
Title: Adding a user
Post by: UseEncryption on January 06, 2004, 08:22:19 am
I\'ve had a similar problem on my desktop.  Turned out that the passwd command can handle some crazy number of characters (256ish perhaps?) , but the login screen variable was truncated at 8.  When at a terminal, you can whack away and create a properly secure passsword (define as you wish, but more than 8 chars anyway), but when you actually try to use it, it is never correct as nothing after the 8th character is ever compared to the shadow value.  I changed desktops to one that had a larger buffer, but perhaps you could try a shorter password?

And while we\'re on it...  the \":x:\" in
joe:x:1000:1000:root:/home/joe:/bin/bash
is a placeholder that replaces a hash of the password.  Even way back whenever it was, they knew better than to expose plaintext passwords. :)