Use this command:
$ sudo adduser --no-create-home --disabled-login --shell /bin/false --system --uid 1001 media
$ sudo addgroup --gid 1001 media
When running the test, using the man pages for the arguments, the -gid
in the adduser
command is suppose to create the group by the specified name and supplied number. However, in this functionality has apparently changed without the docs being updated. On the test, specifying the --gid
fails with the error: adduser: The GID 1001 does not exist
. So I dropped the --gid
to create the new number when creating the user, and added a second command to create the group for the new user.
Update:
Edit a file by the UserID in the /var/lib/AccountsService/users
dir to include these lines:
In this case run this command:
$ sudo nano /var/lib/AccountsService/users/media
Then ensure to include these two lines:
(If the user has logged on this the file should automatically be created. If the user hasn't logged on, then it won't exist. You can manually create it with the commandline above.)
[User]
SystemAccount=true
Now either reboot or restart the lightdm services (depending on your Ubuntu version):
(To avoid logging out you can restart Lightdm
by with Ctrl+Alt+F2. Then run the command below from the console.)
$ sudo service lightdm restart
or (Ubuntu 16.04 and higher)
$ sudo systemctl restart lightdm
Note:
By default, a USERID below 500 is automatically hidden.
Some information in the update can be found in the /etc/lightdm/users.conf
file.
adduser
instead ofuseradd
and don't give a UID - let the system choose one <1000