Linux provides two ways to handle things, one as a normal user and other as a root user. Most people prefer to keep the root privileges to themselves and create a user account for everybody else. Root user has all the privileges to handle the system while any normal user has restricted access to many things. In this article, I am going to tell you how to Add or Remove user accounts in Linux.
You can do it using either the command line or through the graphical way.
Adding a new user
$ sudo adduser <new_user_name>
This will first prompt you for your password, and then
- add a new user with name <new_user_name>
- add a new group with the same name as the user
- create a home directory (/home/<new_user_name>)
- add a few files to this directory (.bashrc, .bash_logout, .profile)
- asks for the password for the new account, twice
- asks for other information (full name, room number, phone numbers)
To add password to the new_user_name,
$ sudo passwd <new_user_name>
Changing the default shell for a user (say to /bin/sh)
$ sudo usermod -s /bin/sh <username>
Now, when the user gets a new terminal, it will open with the shell /bin/sh
Deleting a user
$ sudo deluser <username>
The user will be deleted, but his/her home will remain on the system
$ sudo addgroup <groupname>
will add a new group to the system
$ sudo adduser <username> <groupname>
will add a user to a group
$ sudo deluser <username> <groupname>
will remove a user from a group
changing group and owner for a file
$ sudo chown <username> <filename>
$ sudo chgrp <groupname> <filename>
Note: Sudo command allows a normal user to run commands as a root user under Linux/Unix.
Graphical Way:
You can add or remove user accounts in Linux through the graphical way also.
In Ubuntu, Open System Settings > User accounts. Now, you can add new user here, change password for your Ubuntu System etc.
You may also wanna read how to remove application in Linux Mint.
You can do it using either the command line or through the graphical way.
Adding a new user
$ sudo adduser <new_user_name>
This will first prompt you for your password, and then
- add a new user with name <new_user_name>
- add a new group with the same name as the user
- create a home directory (/home/<new_user_name>)
- add a few files to this directory (.bashrc, .bash_logout, .profile)
- asks for the password for the new account, twice
- asks for other information (full name, room number, phone numbers)
To add password to the new_user_name,
$ sudo passwd <new_user_name>
Changing the default shell for a user (say to /bin/sh)
$ sudo usermod -s /bin/sh <username>
Now, when the user gets a new terminal, it will open with the shell /bin/sh
Deleting a user
$ sudo deluser <username>
The user will be deleted, but his/her home will remain on the system
$ sudo addgroup <groupname>
will add a new group to the system
$ sudo adduser <username> <groupname>
will add a user to a group
$ sudo deluser <username> <groupname>
will remove a user from a group
changing group and owner for a file
$ sudo chown <username> <filename>
$ sudo chgrp <groupname> <filename>
Note: Sudo command allows a normal user to run commands as a root user under Linux/Unix.
Graphical Way:
You can add or remove user accounts in Linux through the graphical way also.
In Ubuntu, Open System Settings > User accounts. Now, you can add new user here, change password for your Ubuntu System etc.
You may also wanna read how to remove application in Linux Mint.
0 komentar:
Posting Komentar