Click here for "Error Codes for Commercial Air Conditioners".(Japanese Version)

LinuxTips(RedHat)_en

LinuxTips(RedHat)_en

Delete user

The command to delete a user is userdel. When this command is executed, the user information will be deleted, but the user's home directory will be left behind. If you want to delete the home directory as well, specify "-r" as an option and execute it.
LinuxTips(RedHat)_en

Changing user settings

The UID, GID, and home directory are specified in advance for the user. If you want to change these information later, use the usermod command. The usermod command can only be executed by root, and it allows you to change various user information. (It is also possible to change the user name).
LinuxTips(RedHat)_en

Create a user

To create and add a new user, use the "useradd" command By specifying a user name as an argument to the command, a user will be created. The user directory will be created under the /home directory, and the group name will be the same as the user name.
LinuxTips(RedHat)_en

Create a group

To create and add a new group, use the "groupadd" command. Information about groups is described in /etc/group and can be edited, but it is better to edit the group information with the vigr command instead of directly editing the "/etc/group" file.
LinuxTips(RedHat)_en

Check the groups to which a user belongs.

Check the group in /etc/passwd and /etc/group (check the gid) Users always belong to a group, and the group described in the /etc/passwd and /etc/group files is the primary group. The gid (group ID) is stored in the /etc/passwd and /etc/group files
LinuxTips(RedHat)_en

Allowing users to belong to multiple groups

Group information in Linux is stored in the "/etc/group" file, which has the following notation tama:x:500: From left to right, tama is the group name, X is the password (when it says X, it is written in the /etc/gshadow file). 500 is the GID. To make a user belong to multiple groups, edit the "/etc/group" file, but it is convenient to use the vigr command to edit the "/etc/group" file. (The operation method is the same as vi)
LinuxTips(RedHat)_en

Execute commands with root privileges as an ordinary user.

When logging in as a regular user, use the sudo command to use commands with root privileges. By specifying the command you want to execute as the argument of the sudo command, you can execute the root command. As a prerequisite, when executing the sudo command, it is necessary to set the user you want to allow to execute in the /etc/sudoers file in advance. Also, the log of sudo command execution is written in a log file via the syslog daemon, and you can know in detail who used what command and when with the sudo command.
LinuxTips(RedHat)_en

Prevent other users from seeing the file.

In Linux, you can prevent other users from seeing a file by using the chmod command to change the file's permissions. Other users are other users who belong to the file's owner group, and other users.
LinuxTips(RedHat)_en

Checking a user's login history

The user's login history will be output to the /var/run/utmp and /var/log/wtmp files. This file, like the /var/log/lastlog and /var/log/btmp files, is a binary file, so it cannot be displayed by the less, cat, or tail commands. To display it, use the dedicated /usr/bin/last command.
LinuxTips(RedHat)_en

Show user's group affiliation

To check which group a particular user belongs to, use the groups command. If you run the command with no arguments, the group to which the user who executed the command belongs will be displayed. If you specify the name of the user whose group you want to display as an argument, the group to which the user belongs will be displayed.
LinuxTips(RedHat)_en

Add and delete groups

●Add a group To create a group, use the groupadd command. When executing this command, specify the group name to be added as an argument. You will need root privileges to run this command.
LinuxTips(RedHat)_en

Set and Remove passwords for groups

To set a password for a group, use the gpasswd command You will be prompted to enter a password when adding a user to a group or when a user is not registered in a group. By setting a password for the group, you can prevent people from registering members to the group without permission.
LinuxTips(RedHat)_en

Set up an administrator for the group.

You can set up an administrator for an existing group separately from root (privileged user). The administrator set here can add and remove members, set and remove group passwords, etc. for the group. To set up an administrator, add the option "-A" to the gpasswd command and specify the user name and the group name to be managed as arguments. Multiple users can be specified by separating them with a comma ",".
LinuxTips(RedHat)_en

Adding and removing members to a group

●Add members to a group To add a member to an existing group, run the gpasswd command with the option "-a". The argument is the name of the user or group to be added and executed. This process can be executed by root or a user registered as a group administrator.
Directory and file operations

Show all files in a directory

To view the files in a directory, use the "ls" command. However, files beginning with a ". (dot) is a hidden file and cannot be displayed by the "ls" command. ." (dot), you can use the "ls" command with the option "-a".