Sergey Nivens - Fotolia


Work a command-line interface in Linux with these permissions and prompts

The command-line interface is an integral part of the Linux management environment. With sudo permissions and remote connectivity, working with a command line is easy.

To properly use a command line in Linux, you must consider two factors: if you need sudo permissions and what commands you want to use. The answers depend on the scale of your operations, what permissions you already have and what changes you'll make in your role.

We'll start with how to connect to Linux. If you're sitting behind a physical Linux machine, connecting is easy, but what about machines that need to be accessed from a distance? Next, you'll learn when to use superuser privileges, and in which cases you shouldn't, and you'll read a bit about working with commands.

The first step to using a command-line interface in Linux is to connect to a server. Many Linux servers run as cloud instances or virtual machines. As a result, you might not see a login prompt on the console you want to connect to; you might need to make a remote connection. If your Linux machine is hosted in a cloud or in a data center, you'll need to connect with Secure Shell (SSH).

Using SSH is easy from a Mac or Linux computer. Simply open a terminal and type the SSH command, followed by username@servername. On a Windows computer, you must first install software that makes the SSH connection for you, such as MobaXterm or PuTTY.

Which user?

You need a username to connect remotely to Linux. Every Linux computer has a user account with the name root, but you shouldn't use this account; it poses a threat to application setups that run with non-administrative privileges. It also complicates tracking session activity, so if a malfunction does occur, it is difficult to identify where the error occurred. The root user is also referred to as the almighty user because it has no restrictions.

On Windows, there is no equivalent to the Linux root user; a Windows Administrator account is limited in its capabilities. To connect to a command-line interface in Linux on Windows, you'll need access to the user account from whoever installed the machine.

Once you have the username and password, you should be able to open a login session to your Linux machine as an ordinary user.

Using sudo with a command-line interface in Linux

If you're on Ubuntu, administrative tasks run through sudo, which implements system-wide changes. For instance, instead of typing useradd linda, you'd use the command sudo useradd linda. Sudo commands do have one requirement though: The account needs sudo privileges.

To run ordinary prompts with a command-line interface in Linux, you don't need specific permissions.

On Ubuntu, the first user that was created has sudo privileges. On Red Hat, the account you use needs to be a member of the wheel group. You can get these permissions from your server administrator if you don't already have them.

To run ordinary prompts with a command-line interface in Linux, you don't need specific permissions, but you must know what each command does, which is challenging. Hundreds of commands are typically available, and each has multiple command-line options. For new Linux console users, this presents a steep learning curve. However, you can build a knowledge base with programming courses, reference sheets and online forums.

If you need more information about a command, you can read its documentation using man, followed by the command. For instance, type man useradd to get a full description of how to use the useradd command, and type q to leave the man page. Documentation in man exists for nearly all of the commands, and it is an excellent informational resource built into the Linux command-line interface.

Dig Deeper on Data center ops, monitoring and management

Cloud Computing
and ESG