Skip to main content

Posts

Showing posts from March, 2019

Managing Supplementary Groups

A group must exist before a user can be added to that group. Several command-line tools are used to manage local group accounts. groupadd Creates Groups groupadd groupname without options uses the next available GID from the range specified in the /etc/login.defs file. The -g GID option is used to specify a specific GID. [student@serverX ~]$ sudo groupadd -g 5000 ateam Note Given the automatic creation of user private groups (GID 1000+), it is generally recommended to set aside a range of GID numbers to be used for supplementary groups. A higher range will avoid a collision with a system group (GID 0-999). The -r option will create a system group using a GID from the range of valid system GID numbers listed in the /etc/login.defs file. [student@serverX ~]$ sudo groupadd -r appusers groupmod Modifies Existing Groups The groupmod comm

Managing Local Users

A number of command-line tools can be used to manage local user accounts. useradd Creates Users useradd username sets reasonable defaults for all fields in /etc/passwd when run without options. The useradd command does not set any valid password by default, and the user cannot log in until a password is set. useradd --help will display the basic options that can be used to override the defaults. In most cases, the same options can be used with the usermod command to modify an existing user. Some defaults, such as the range of valid UID numbers and default password aging rules, are read from the /etc/login.defs file. Values in this file are only used when creating new users. A change to this file will not have an effect on any existing users. usermod Modifies Existing Users us

The root User

Most operating systems have some sort of superuser , a user that has all power over the system. This user in Red Hat Enterprise Linux is the root user. This user has the power to override normal privileges on the file system, and is used to manage and administer the system. In order to perform tasks such as installing or removing software and to manage system files and directories, a user must escalate privileges to the root user. Most devices can only be controlled by root , but there are a few exceptions. For instance, removable devices, such as USB devices, are allowed to be controlled by a normal user. Thus, a non-root user is allowed to add and remove files and otherwise manage a removable device, but only root is allowed to manage "fixed" hard drives by default. This unlimited privilege, however, comes with responsibility. root has unlimited power

What is a User?

Every process (running program) on the system runs as a particular user. Every file is owned by a particular user. Access to files and directories are restricted by user. The user associated with a running process determines the files and directories accessible to that process. The id command is used to show information about the current logged-in user. Basic information about another user can also be requested by passing in the username of that user as the first argument to the id command. [student@desktopX ~]$ id uid=1000(student) gid=1000(student) groups=1000(student),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 To view the user associated with a file or directory, use the ls -l command. The third column shows the username: [student@serverX ~]$ ls -l /tmp drwx------. 2 gdm gdm 4096 Jan 24 13:05 orbit-gdm drwx------. 2 student student 4096 Jan 25 20:40 orbit-student -rw-r--r--. 1 root ro

Editing Files with Vim

A key design principle of Linux is that information is stored in text-based files. Text files include both flat files with rows of similar information, such as configuration files in /etc , and Extensible Markup Language (XML) files, which define data structure through text tags, seen in application configuration files throughout both /etc and /usr . The advantage of text files is that they can be moved or shared between systems without requiring conversion, and can be viewed and edited using any simple text editor. Vim is an improved version of the vi editor distributed with Linux and UNIX systems. Vim is highly configurable and efficient for practiced users, including such features as split screen editing, color formatting, and highlighting for editing text. Moving between Vim modes When first opened, Vim starts in command mode , used for navigation, cut and paste, and other text manipulation. Ente

File system Globbing

File Globbing: Path Name Expansion The Bash shell has a path name-matching capability historically called globbing , abbreviated from the " global command " file path expansion program of early UNIX. The Bash globbing feature, commonly called pattern matching or " wildcards " , makes managing large numbers of files easier. Using meta-characters that " expand " to match file and path names being sought, commands perform on a focused set of files at once. Pattern Matching Globbing is a shell command-parsing operation that expands a wildcard pattern into a list of matching path names. Command-line meta-characters are replaced by the match list prior to command execution. Patterns, especially square-bracketed character classes, that do not return matches display the original pattern request as literal text. The following are common meta-characters and pattern classes.

File system Management

Command-line File Management File management involves creating, deleting, copying, and moving files. Additionally, directories can be created, deleted, copied, and moved to help organize files logically. When working at the command line, file management requires awareness of the current working directory to choose either absolute or relative path syntax as most efficient for the immediate task. File Management Commands Activity Single source (note) Multiple source (note) Copy file cp file1 file2 cp file1 file2 file3 dir (4) Move file mv file1 file2 (1) mv file1 file2 file3 dir (4) Remove file rm file1 rm -f file1 file2 file3 (5) Create directory mkdir dir mkd

tag