You are on page 1of 4

Komandat e perdoruesit ne Linux

• • •
Adding a new user (useradd) Modifying an existing user (usermod) Where user and group information is stored

• • •

Deleting a user (userdel) User's passwd passwd Switch User su

Every user who has access to a Linux system needs a login and a password. Each user must belong to a primary group and for security or access purposes can belong to several secondary groups. In order to create new logins, modify or delete users, you must already be logged in as root. The root login is the highest level and only certain individuals should have access to the root account.

useradd - Adding a new user
Options:
• • • • • •
-d home directory -s starting program (shell) -p password -g (primary group assigned to the users) -G (Other groups the user belongs to) -m (Create the user's home directory

Example: To add a new user with

• • • • • • •

a primary group of users a second group mgmt starting shell /bin/bash password of xxxx home directory of roger create home directory a login name of roger

useradd -gusers -Gmgmt -s/bin/shell -pxxxx -d/home/roger -m roger top of page

usermod - Modifying existing user

passwd roger Enter existing password (can be either roger's password or root's password) Enter new password Enter new password again (to validate) ..User's Password Options: • user's name (Only required if you are root and want to change another user's password) Example: To change the password for the account you are currently logged in as.. passwd Enter existing password Enter new password Enter new password again (to validate) Example: To change the password for the user 'roger' (only you are logged in as root).Deleting a user Options: • -r (remove home directory) Example: To remove the user 'roger' and his home directory userdel -r roger top of page passwd ...Options: • • • • • -d home directory -s starting program (shell) -p password -g (primary group assigned to the users) -G (Other groups the user belongs to) Example: To add the group 'others' to the user roger usermod -Gothers roger top of page userdel .

only contains the letter 'x') User ID (a unique number of each user) Primary Group ID Comment (Normally the person's full name) Home directory (normally /home/<user name> Default shell (normally /bin/bash) Each field is separated by a colon. Passwords for each user are stored in /etc/shadow. use the su command. top of page su . the default files and directories that are created are stored in /etc/skel. • • • • • • • User (name normally all lower case) Password (encrypted . This file should only be changed using the passwd command. su Enter root's passwd .Switch User To switch to another user. although this is not recommended.. Default files When a new user is created. Example: To switch to root account.. Format of the file is.. This is most commonly used to switch to the root account. Modifications only effect new users and does not change anything for existing users.. Format of the file is.. • • • • Group name Group password (hardly ever used) Group ID User names (separated by commas) Each field is separated by a colon..top of page Where user and group information stored User names and primary groups are stored in /etc/passwd. This file can be directly edited using the 'vi' editor. Group information is stored in /etc/group. This directory can be modified to fit your needs. This file can be directly edited using the 'vi' editor.

. su roger Enter roger's or root's passwd To return to original user.org/os/linux/commands/linux_cruserman.Example: To switch to the user 'roger'.html . enter exithttp://www.comptechdoc..