MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for the ‘Linux System Administration’ tag

User/Group Setups

without comments

The following are samples of creating, changing, and removing users and groups in Linux. These are the command-line options in the event you don’t have access to the GUI tools.

Managing Users:

Adding a user:

The prototype is:

# useradd [-u uid] [-g initial_group] [-G group[,...]] \
 > [-d home_directory] [-s shell] [-c comment] \
 > [-m [-k skeleton_directory]] [-f inactive_time] \
 > [-e expire_date] -n username

A sample implementation of the prototype is:

# useradd -u 502 -g dba -G users,root \
 > -d /u02/oracle -s /bin/tcsh -c "Oracle Account" \
 > -f 7 -e 12/31/03 -n jdoe

Modifying a user:

The prototype is:

 # usermod [-u uid] [-g initial_group] [-G group[,...]] \
 > [-d home_directory] [-s shell] [-c comment] \
 > [-l new_username ] [-f inactive_time] [-e expire_date]
 > username

A sample implementation of the prototype is:

# usermod -u 502 -g dba -G users,root
 > -d /u02/oracle -s /bin/bash -c "Senior DBA"
 > -l sdba -f 7 -e 12/31/03 jdoe

Removing a user:

The prototype is:

# userdel [-r] username

A sample implementation of the prototype is:

# userdel -r jdoe

Managing Groups:

Adding a group:

The prototype is:

# groupadd [-g gid] [-rf] groupname

A sample implementation of the prototype is:

# groupadd -g 500 dba

Modifying a group:

The prototype is:

# groupmod [-g gid] [-n new_group_name] groupname

A sample implementation of the prototype is:

 # groupmod -g 500 -n dba oinstall

Deleting a group:

The prototype is:

# groupdel groupname

A sample implementation of the prototype is:

# groupdel dba

Installing a GUI Manager for Users and Groups:

If you’re the root user or enjoy sudoer privileges, you can install the following GUI package for these tasks:

yum install -y system-config-users

You can verify the GUI user management tool is present with the following command:

which system-config-users

It should return this:

/bin/system-config-users

You can run the GUI user management tool from the root user account or any sudoer account. The following shows how to launch the GUI User Manager from a sudoer account:

sudo system-config-users

As always, I hope this helps those trying to figure out the proper syntax.

Written by maclochlainn

June 19th, 2023 at 10:48 pm

AlmaLinux+VSCode

with one comment

How to install and configure VSCode on AlmaLinux (Red Hat Enterprise 9). This is a step-by-step version of the Visual Studio documentation. The first thing you do is download the Microsoft packages:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

Next, create the yum repository with the following command:

sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

It creates the following vscode.repo file in the /etc/yum.repos.d directory:

[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc

Then, update the package cache and install the package using dnf dnf, like this as the sudoer user:

sudo dnf check-update

The log file for this is:

You can install the VSCode package using dnf dnf, like this as the sudoer user:

sudo dnf install -y code

The log file for this is:

Click on Activities in the upper left corner and then the clustered nine dots to view applications. Choose the Visual Studio and double click and you should see the following dialog:

Choose a color schema that works for you, then click the less than symbol in the top left hand corner to start working with Visual Studio Code:

As always, I hope this helps those looking for step-by-step instructions and clarity of complete examples.

Written by maclochlainn

December 19th, 2022 at 8:50 pm

Fedora Exlixir Install

without comments

Having played around with Erlang some twelve years ago, I felt it was time to experiment with the Elixir programming language. The install on Fedora was straightforward with Dandified YUM. Naturally, you need to be the root user or a user found in the sudoer‘s list:

sudo dnf install -y elixir

The installation said to add it to the $PATH variable but on Fedora 30, a symbolic link of elixir is installed in the /usr/bin directory that points to /usr/share/elixir/1.9.0/bin/elixir shell script. Next, a version check, like this:

elixir --version

it returned

Erlang/OTP 21 [erts-10.3.5.11] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]
 
Elixir 1.9.0 (compiled with Erlang/OTP 21)

Next, I created a little elixir test program, naturally after I glanced through the documentation for a Hello World program, like this hello.exs file:

IO.puts "Hello, Elixir World!"

Then, I ran it as stand alone file with only read and write, read, and read privileges:

elixir hello.exs

It returns:

Hello, Elixir World!

Next, I tried to read the file from the file system in the iex interactive shell. I thought the example on the website was odd because it gave the impression that you were to call iex recursively but I discovered that’s not the case. You can only run it from the OS shell, and the file must have read, write, execute privileges for whomever calls it. Then, this syntax works from the Linux CLI interfaace:

iex -S hello.exs

Then, you exit the shell by issuing a ^Z (CTRL+Z). If you try ^C, you’ll need to follow that with ^D, which I found in some notes. The ^Z is the normal kill signal for the current process, which appears the proper way to exit the iex interactive shell. Overall, the interactive shell is virtually useless except to validate small syntax examples.

Written by maclochlainn

May 20th, 2020 at 11:47 pm