2

I added a new user via terminal using the command useraddon Ubuntu:

useradd -u 210 -g dba -s /bin/bash -d /home/oracle -m oracle

I can login this new user via terminal. But I want login window for this new user when I boot my system so that I can directly login to this user for my specific tasks. How to achieve this please?

  • What groups does the new user belong to ? – Digisec Jan 11 '16 at 15:22
  • @terdon one thing remaining to ask regarding this Q. Just take this example: I want to create an account in my laptop with GUI login for my kid so that she can play games there , watch movies and videos, photos etc. For this I need to set her account with restricted shell. For this purpose please confirm that the way I created account with big UID is the way of achieving my requirement. – Ravi Jan 12 '16 at 1:59
  • @Ravi yes, you should use useradd username. Not sure what you mean by "restricted shell" though. Again, that probably deserves a separate question. Make sure you explain what kind of restrictions you are thinking of. – terdon Jan 12 '16 at 9:53
1

According to the Linux Standard BAse:

The system User IDs from 0 to 99 should be statically allocated by the system, and shall not be created by applications.

The system User IDs from 100 to 499 should be reserved for dynamic allocation by system administrators and post install scripts using useradd.

So, regular users should have UIDs > 499. Furthermore, the Debian Policy states that:

0-99:

Globally allocated by the Debian project, the same on every Debian system. These ids will appear in the passwd and group files of all Debian systems, new ids in this range being added automatically as the base-passwd package is updated.

Packages which need a single statically allocated uid or gid should use one of these; their maintainers should ask the base-passwd maintainer for ids.

100-999:

Dynamically allocated system users and groups. Packages which need a user or group, but can have this user or group allocated dynamically and differently on each system, should use adduser --system to create the group and/or user. adduser will check for the existence of the user or group, and if necessary choose an unused id based on the ranges specified in adduser.conf.

1000-59999:

Dynamically allocated user accounts. By default adduser will choose UIDs and GIDs for user accounts in this range, though adduser.conf may be used to modify this behavior.

This also applies to Ubuntu since it is based on Debian. I haven't found an explicit mention of this but, in general, system users are not allowed to log in graphically and, often, not allowed to log in at all. Therefore, the reason why your user couldn't log in was that you had chosen a UID that was too low.

Additionally, in the Debian world, it is recommended to use adduser and not useradd when creating accounts. From man useradd:

useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.

All this is to say that i) you should have used a UID >=1000 and ii) just use adduser and accept the defaults and everything will be set up as you expect it.

  • Thank you very much for providing me with so much information from different sources rather than simply answering my Q. When I get time I will study those sources & increase my knowledge base. – Ravi Jan 12 '16 at 11:41
  • Sorry for being a bit out of topic in this current comment but I would like to say that Terdon, I was pleased to see your reply to my this Q. Because it had been a long time earlier when I got your reply to my Q. Earlier also your solution included links to study materials & references w.r.t. my Q. I always gained a lot from your reply. Thank you very much. – Ravi Jan 12 '16 at 11:49
  • 1
    @Ravi you're very welcome :) – terdon Jan 12 '16 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.