Managing Users in Ubuntu

add a user: sudo adduser [newuser]
[bash]sudo adduser john[/bash]
then give password, and setup home folder,when prompted

edit the list of super users
[bash]visudo[/bash]

list users
[bash]cat /etc/passwd[/bash]

change password of a user – sudo passwd [username]
[bash]sudo passwd john[/bash]
to change your password you can just use sudo passwd.

delete user

[bash]sudo deluser username[/bash]

This will not delete the home folder (and subfolder) those must be dealt with separately. A new user created with the old user name would have access to those files.

temporarily lock a user account – Simply locking a user account will not prevent a user from logging into your server remotely if they have previously set up RSA public key authentication.

[bash]sudo passwd -l username[/bash]

To unlock the account

[bash]sudo passwd -u username[/bash]

Groups

Groups are used in to control permissions (see file permissions)
add user to a group
usermod -G [group-name] [username]
[bash]usermod -G basketball john[/bash]
using the -G switch ads the group as a supplemental group. Using -g would make the group that users primary group.

see what groups a user is in
[bash]id john[/bash]

add a new group: groupadd [new_group_name]
[bash]groupadd ruby_developers[/bash]

1 thought on “Managing Users in Ubuntu

  1. Pingback: Locking and Unlocking a User in Ubuntu | Coding and Server Syntax Examples

Leave a Reply

Your email address will not be published. Required fields are marked *

This Blog will give regular Commentators DoFollow Status. Implemented from IT Blögg