MJay
how to add, delete, modify users?[script] 본문
410
190
|
I need a command to list all users in terminal. And how to add, delete, modify users from terminal. That could help in administrating your accounts easily by terminal. |
||||
|
585
|
To list all local users you can use:
To list all users capable of authenticating (in some way), including non-local, see this reply: http://askubuntu.com/a/414561/571941 Some more useful user-management commands (also limited to local users): To add a new user you can use:
or:
See also: What is the difference between adduser and useradd? To remove/delete a user, first you can use:
Then you may want to delete the home directory for the deleted user account : sudo rm -r /home/username (Please use with caution the above command!) To modify the username of a user:
To change the password for a user:
To change the shell for a user:
To change the details for a user (for example real name):
And, of course, see also: |
||||||||||||||||||||
|
48
|
Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
OR
You can also use awk:awk
|
||||||||||||
|
30
|
The easiest way to get this kind of information is cat /etc/passwd it is useful to remember because it will give you lists of several elements in the OS.To get a list of all users you type (as users are listed in
To add a user newuser to the system you would type
to create a user that has all default settings applied. Bonus: To add any user (for instance anyuser) to a group (for instance cdrom) type
You delete a user (for instance obsolete) with
If you want to delete his home directory/mails as well you type
And
will remove the user and all files owned by this user on the whole system. |
||||
|
8
|
list of all users who can login (no system users like: bin,deamon,mail,sys, etc.)
add new user
or
delete/remove username
If you want to delete the home directory (default the directory /home/username)
or
If you want to delete all files from the system from this user (not only is the home diretory)
|
||||
|
7
|
This should get, under most normal situations, all normal (non-system, not weird, etc) users:
This works by:
This is because on many linux systems, usernames above 1000 are reserved for unprivileged (you could say normal) users. Some info on this here:
|
|||
6
|
Ok here is a trick that will help you sort this. The terminal has auto completion if you type user and hit Tab key twice it will list all the commands that exist with user as the first 4 chars.
gives me as possible options
useradd userdel usermod users users-admin to list users you should go with what Mitch said. Hope that helps I love tab completion in bash saves me from remembering things. |
||
1
|
To find out the users which have home-directories in the /home-folder on the machine, run the following commands
You can then see the users who have authorization to log into the server. If we want to look into the files of any users, you must be the root user. |
||||
|
protected by Radu Rădeanu Feb 22 '15 at 17:21
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Not the answer you're looking for? Browse other questions tagged command-line user-management or ask your own question.
'Linux' 카테고리의 다른 글
윈도우 포트 변경 (0) | 2017.04.14 |
---|---|
우분투 16.04 포트 변경하기 (0) | 2017.04.14 |
Script Shell (0) | 2017.02.18 |
FUSE (0) | 2017.02.18 |
Touch 명령어 (0) | 2017.02.17 |