Sorry about that, I should've explained before telling you to run anything with elevated privileges...
It reads the contents of the file /var/log/syslog
which as the name suggests contains a log of different system events. Then we process it using grep
to narrow down the lines that contain the word "user" hopefully highlighting what went wrong when you tried to create the user. The final command, less
will display the results in a so-called pager, to avoid cluttering your terminal session too much since this file can be quite lengthy indeed.
It's very strange that it takes more than a minute, and that's already pushing it, but I guess if there's a lot of text to process it could even hangup.
I assume that by the time you read this you've already close the terminal, and that's fine, it's perfectly safe to cancel it since it's only reading a file and not writing or changing anything (You can interrupt the process by presing Ctrl + C).
Let's try this instead: go ahead and attempt to create a new user in the exact same way as you did before where it shows you the error. Immediately after, open a terminal and run the following:
sudo tail -n 50 /var/log/syslog
This is very similar except it will only print the last 50 lines of the file, thus saving all the trouble of processing a potentially giant file. You can safely increase this number even further to 100, 200, 300, etc... but it should show up the latest events near the bottom, meaning the error regarding the new user creation attempt.
And while you are at it, just to confirm if the size of this file may have been an issue earlier you can do:
ls -lh /var/log/syslog
On a fairly new virtual machine after a few tests with creating users this is how it appears.
zenzen@zenzen:~$ ls -lh /var/log/syslog
-rw-r----- 1 syslog adm 368K mar 19 11:34 /var/log/syslog
This will print a single line showing the file in a bit more detail, most importantly right now the size of the file. It should normally be a few KBs in size, but sometimes when there are repeated errors this can grow a lot up to the Gb... which doesn't necessarily mean anything is wrong, but it could explain why it did get hung up earlier.
Normally installed programs are globally available (meaning that all users can access them) and new user accounts will also have access to them. Only files under the user's home folder are restricted to that user.