Tag: useradd

By Clarence E Johnson

There are several ways to create a users and groups in Linux that are graphical, however the standard way to create a user is through the command line.

id command in terminalStep one is to create the group, then create the user and place the user in the group. In Linux when a user is created without specifying a group then a group is created by the same name as the user. Consider a system that has 100 users if each user was created without specifying a group then there will be 100 groups. You must be root in order to create users, groups, and users’ passwords.

# groupadd executive

Creates the executive group. To verify that a group was created view the /etc/group file.

# useradd -d /home/gbush -group executive gbush

Creates the directory /home/gbush, add the user gbush to the group executive group. To verify that the user was created view the /etc/passwd file. This file contains a record of all of the users on the system.

# passwd gbush

texan

texan

Creates a password for the user gbush as texan. The password of texan does not fit the necessary length and complexity, but as root you can change the password to anything you want.

# useradd -d /home/dcheney -group executive dcheney

Other useful commands are

userdel and groupdel for deleting users and groups.

usermod and groupmod for modifying users and groups.

Tip:

Considering the current political structure of this example (executive, legislative and judicial) can help you create groups, then add the appropriate users.

New Sessions

In Linux you can create login sessions by pressing Control+ALT and Function1 through Function6 keys. This is a good way to test the new user accounts.

Identity

Because it can be difficult knowing who you are logged in as you can type the following command

#id

This will tell you who you are and what groups you belong to.

You may also become another user by using the su command.

#su gbush

This command would allow you to become gbush. If you are not the root user then you will be asked for the password of gbush.

#su – gbush

The above command says that you want to become gbush and you would like to run his startup scripts and be placed in his home directory.

You may become a member of a different group by using the newgrp command.

#newgrp executive

Would place you in the executive group. Please note that if this is not your default group as noted in the /etc/passwd file, and you are not listed as a member in the /etc/group file then you will not be allowed to become a member of the group. As far as root is concerned, root can do anything at anytime.

HELP

Help can be obtained by using the manual command.

#man ls

Would give you the manual page of the ls command. This can be quite helpful if you forget an option to a command.

If you cannot remember a command but you know what it is similar to you can use the apropos command.

# apropos who

Would show you all of the command that have the word contain the world who.

The help command can be used to get help on some built in command.

#help logout

If you are concerned about where in the file system a command would be run from type in the following

#whereis rm

Would show you where in the system the rm command would be executed, if you were to type the command.

If you know part of the command but you would like to know where it exist on the system you can use the locate command which searches a database of file name that is maintained nightly.

#locate who

Would show you all of the files that have the word who in them. This search is done through out the system. This is good for user defined commands.

Commands

In order to configure the Linux computer for different services, you should have a good understanding of standard UNIX and TCP/IP commands. These are a few of the commands that are used in Linux:

ls

who

cat

pwd

cd

telnet

rlogin

ftp

rcp

traceroute

login

man

cp

bash

ln

passwd

rm

su

touch

startx

df

du

rsh

uptime

vi

pico

at

cron

more

find

rmdir

mkdir

ping

nslookup

This submission is made by Clarence E. Johnson, president of Johnson Computer Technologies Inc in St. Louis, MO. Please visit http://www.johnsonct.net for more info on Mr. Johnson.

Tags: , , , , , , ,

By Clyde E. Boom

Linux Commands – The great thing about Linux commands is that they are virtually identical from one Linux distribution (version) to another. So the way the real pros do Linux administration is to work at the Linux command line and run Linux command lineLinux commands.

Learning how to run a Linux command can be very difficult for someone new to Linux, so here are some Linux tips that will help you to learn how to use Linux commands when working at the Linux command line prompt.

There are three main parts of a Linux command:

1. The Linux command name

2. Options that can be used with the Linux command

3. The “item(s)” that the Linux command is being run “on”

When you run a Linux command, spaces are used between: the Linux command name, the command options and the “item” the command is being run “on”. The “item” could be a Linux directory, file, user or some other Linux software component.

For example, you run the Linux command named ls (for list) “on” a Linux directory to see a list of files in the directory. You run the Linux command named rm (remove) “on” a Linux directory to remove the directory from the Linux file system.

To run a Linux command, you type in the name of the command, and any other parts of the command, such as options, and press the Enter key.

You can see an example of the Linux command that is used to create a new Linux user below. The useradd command is being run “on” the bthatcher user name to create this Linux user.

Linux Tips: Linux commands are run at the Linux command line prompt and this prompt is shown as ]# at the left of the command. You don’t type in the prompt, you type the Linux command at the right of the prompt.

Linux Tips: The Linux command prompt may also appear as: ]$ or as another symbol, instead of # or $.

]# useradd -c “Becky Thatcher” bthatcher

This Linux command creates a new Linux user named bthatcher with the full name of “Becky Thatcher”. The -c (for comment) option is used with this command to add the full name as a comment to the Linux user name of bthatcher.

One of the easiest and best ways to get Linux training is to see Linux commands being run in Linux video tutorials. With this method – you see, hear and do.

With a Linux video tutorial, you see and hear how to run a Linux command and see and hear a description of the output of the command. You can also pause the video so you can run the Linux command yourself!

Copyright ©  Clyde Boom

Clyde Boom, Author and Expert Trainer with 20+ Years of Training Successes. Explains intricate technical matters in an easy-to- understand, non-technical manner, with tens of thousands of software and hardware learners into masters.

You can watch Free Sample I Learn Linux Video Tutorials at http://www.iLearnLinux.com and get over the steep Linux learning curve.

Sign up for Free I Learn Linux News to receive technical tips, info on new video samples and important updates on Linux.

You need to learn Linux the easy way to get that new job, qualify for that next promotion, earn a hefty raise, get Linux certification, or keep your current job because your company is trying to save on software licensing fees (eza). Watch, do, and learn!

Tags: , , , , , , , , , , ,
Back to top