tags: os operating-system computer linux unix is_child_of: operating-systems
Users
Adding users
We can add users using command useradd
useradd nitinWe have to create a directory of this user and user permissions to that directory.
mkdir /home/nitin
chown nitin /home/nitinNow if we see the permissions we will see,
root@515d32d1d259:/home/hemant# ls -alrt /home
total 12
drwxr-xr-x 1 nitin root 4096 Apr 6 11:27 nitin
drwxr-xr-x 1 root root 4096 Apr 6 11:27 ..
drwxr-xr-x 1 root root 4096 Apr 6 11:39 .There is one more way to create a user.
adduser nitinThis does everything for you.
Deleting user
userdel nitin
rm -rf /home/nitinor
deluser nitinSwitching user
su nitinsu is switch user command.
Changing the password
passwd nitin
New Password:
Retype New Password:Groups
A group is a collection of users with a set of permissions.
Creating a group
groupadd bitphileAdding group to directory and file
chgrp nitin /home/nitinAdding user to the group
usermod -aG bitphile nitin-aG means add group.
Delete user from the group
gpasswd -d bitphile nitinDelete group
groupdel bitphileSee also
- sudoers file