[Not Recommended]adduser command may have gremlins

Please reproduce your error on a second machine before posting, and check the error by running without saved changes or extra modules (See FAQ No. 13, "How to report a bug"). For unstable Porteus versions (alpha, beta, rc) please use the relevant thread in our "Development" section.
aus9

[Not Recommended]adduser command may have gremlins

Post#1 by aus9 » 19 Oct 2015, 06:21

Longer topic

I am reporting a bug in the XFCE 64 bit v3.1
open a terminal and gain root and use adduser command to adduser.

New user exists on reboot but there are gremlins in the /etc directory as follows
First I am gordon and booted into gordon

Lets make a new user so I can copy and paste the terminal bits of interest.

Code: Select all

root@porteus:/home/gordon# adduser test

Login name for new user: test

User ID ('UID') [ defaults to next available ]: 1111

Initial group [ users ]: 
Additional UNIX groups:

Users can belong to additional UNIX groups on the system.
For local users using graphical desktop login managers such
as XDM/KDM, users may need to be members of additional groups
to access the full functionality of removable media devices.

* Security implications *
Please be aware that by adding users to additional groups may
potentially give access to the removable media of other users.

If you are creating a new user for remote shell access only,
users do not need to belong to any additional groups as standard,
so you may press ENTER at the next prompt.

Press ENTER to continue without adding any additional groups
Or press the UP arrow key to add/select/edit additional groups
:  

Home directory [ /home/test ] 

Shell [ /bin/bash ] 

Expiry date (YYYY-MM-DD) []: 

New account will be created as follows:

---------------------------------------
Login name.......:  test
UID..............:  1111
Initial group....:  users
Additional groups:  [ None ]
Home directory...:  /home/test
Shell............:  /bin/bash
Expiry date......:  [ Never ]

This is it... if you want to bail out, hit Control-C.  Otherwise, press
ENTER to go ahead and make the account.


Creating new account...


Changing the user information for test
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Changing password for test
Enter the new password (minimum of 5 characters)
Please use a combination of upper and lower case letters and numbers.
New password: 
Re-enter new password: 
passwd: password changed.


Account setup complete.
look OK

Code: Select all

cat /etc/shadow | grep test
test:$5$eHNNSo4qFBa$FSP1OvBca8dn6iyAKE6Xy0ukE.KyD5xLN3c8p6CBGV8:16727:0:99999:7:::
Now lets look at my concerns

Code: Select all

cat /etc/group | grep test
root@porteus:/home/gordon# 
(meaning no entry)

cat /etc/passwd | grep test
test:x:1111:100:,,,:/home/test:/bin/bash
the last bit ...I am not sure of so compare it to this please.

Code: Select all

cat /etc/passwd | grep guest
guest:x:1000:1000::/home/guest:/bin/bash
Yes it looks like the adduser should provide UID:UID but newuser is showing UID:non-UID

What did you think?

###########################
also

Code: Select all

cat /etc/group | grep guest
disk:x:6:root,adm,guest
lp:x:7:lp,guest
floppy:x:11:guest
dialout:x:16:uucp,guest
audio:x:17:guest
video:x:18:guest
cdrom:x:19:guest
games:x:20:guest
power:x:84:guest
netdev:x:86:guest
scanner:x:93:guest
vboxusers:x:96:guest
users:x:100:guest
guest:x:1000:guest
I will add myself to audio,cdrom, video and will take advice on other groups if you can spare the time.
At this stage I am not printing or scanning or using virtual machine, games, dial up modem, floppy drive
Last edited by aus9 on 19 Oct 2015, 22:34, edited 1 time in total.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: adduser command may have gremlins

Post#2 by Bogomips » 19 Oct 2015, 12:31

AFAIK there can only be TWO users, any more means gremlins could pop up. =@
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

aus9

Re: [Not Recommended]adduser command may have gremlins

Post#3 by aus9 » 19 Oct 2015, 22:36

OK
I have not marked as solved, as in some ways, bug is confirmed. Maybe later, the FAQ could include the recommendation not to have another account?

thanks for the heads up. I shall add a password to guest. Already done root's.

I shall try a suggestion post to see if its receptive.

go2null
White ninja
White ninja
Posts: 25
Joined: 19 Aug 2014, 18:28
Distribution: LXDE-v3.0.1-i486.iso
Location: Canada

Re: [Not Recommended]adduser command may have gremlins

Post#4 by go2null » 18 Dec 2015, 01:55

The "convention" of setting group id (GID) = user id (UID) exists only in the Desktop world and is not universal.

Also, the useradd dialog explicitly states that the GID will be set to users, not UID.

Code: Select all

Initial group....:  users
...
test:x:1111:100:,,,:/home/test:/bin/bash
(users is GID 100)

Code: Select all

guest@porteus:~$  grep '^users' /etc/group 
users:x:100:guest

If you wish to have the GID set to UID, then use useradd.

Code: Select all

guest@porteus:~$  useradd --help
Usage: useradd [options] LOGIN
       useradd -D
       useradd -D [options]

Options:
  -b, --base-dir BASE_DIR       base directory for the home directory of the
                                new account
  -c, --comment COMMENT         GECOS field of the new account
  -d, --home-dir HOME_DIR       home directory of the new account
  -D, --defaults                print or change default useradd configuration
  -e, --expiredate EXPIRE_DATE  expiration date of the new account
  -f, --inactive INACTIVE       password inactivity period of the new account
  -g, --gid GROUP               name or ID of the primary group of the new
                                account
  -G, --groups GROUPS           list of supplementary groups of the new
                                account
  -h, --help                    display this help message and exit
  -k, --skel SKEL_DIR           use this alternative skeleton directory
  -K, --key KEY=VALUE           override /etc/login.defs defaults
  -l, --no-log-init             do not add the user to the lastlog and
                                faillog databases
  -m, --create-home             create the user's home directory
  -M, --no-create-home          do not create the user's home directory
  -N, --no-user-group           do not create a group with the same name as
                                the user
  -o, --non-unique              allow to create users with duplicate
                                (non-unique) UID
  -p, --password PASSWORD       encrypted password of the new account
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shell SHELL             login shell of the new account
  -u, --uid UID                 user ID of the new account
  -U, --user-group              create a group with the same name as the user
A quick read of /usr/sbin/adduser (it is a shell script) is illuminating.

Post Reply