Tag Info

New answers tagged


First set a variable containing the username: myUSER=user1 Then call the adduser script using: sudo adduser --ingroup teacher "$myUSER"


That $6$rounds=5000 is probably part of the problem, because except for the leading $6, the entire value passed to adduser has to be a valid hash. Also (not apparent in your script fragment), the value should be quoted to avoid parameter expansion, e.g., adduser -m -p '$6$gehr8sgkkX$lMZ5bmb7c4HY76pnn0uUXA5wH51YE0Byp4rIfcA94gwrVvfEnVQ ...


Probably because you do not use the userdel command as superuser (root) or other privileged user. Try: sudo userdel accountname As stated in several comments it is also possible to remove the homedirectory configured while removing the useraccount using: sudo userdel -r accountname


The adduser command by default also creates a /home/user directory for system users, which you cannot do with the useradd command. useradd only adds home directories for normal users not system users.


As per man useradd, it creates SUB_UID_COUNT secondary uid range reserved for each user SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number) If /etc/subuid exists, the commands useradd and newusers (unless the user already have subordinate user IDs) allocate SUB_UID_COUNT unused user IDs from the range SUB_UID_MIN to SUB_UID_MAX for each new ...


Most programs that need to care about usernames will do a getent() lookup to find the UID and use that from then on - that's because users are identified by the uid, the number. The name is not much more than pretty-printing and convenience. For example, run id 1000 or getent passwd 1000 and they will only display the first entry for that uid. It is not ...

Top 50 recent answers are included